Using multiple criteria to find a WebElement in Selenium

后端 未结 3 794
南方客
南方客 2021-01-02 02:59

I am using Selenium to test a website, does this work if I find and element by more than one criteria? for example :

 driverChrome.findElements(By.tagName(\"         


        
3条回答
  •  清歌不尽
    2021-01-02 03:41

    CSS Selectors would be perfect in this scenario.

    Your example would

    By.css("input#id_start.blabla")
    

    There are lots of information if you search for CSS selectors. Also, when dealing with classes, CSS is easier than XPath because Xpath treats class as a literal string, where as CSS treats it as a space delimited collection

提交回复
热议问题