Using multiple criteria to find a WebElement in Selenium

后端 未结 3 796
南方客
南方客 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 04:00

    To combine By statements, use ByChained:

    driverChrome.findElements(
        new ByChained(
            By.tagName("input"),
            By.id("id_Start"),
            By.className("blabla")
        )
    )
    

    However if the criteria refer to the same element, see @Saifur's answer.

提交回复
热议问题