Find element by attribute

后端 未结 4 1730
鱼传尺愫
鱼传尺愫 2020-11-30 03:37

I am trying to find an element with Attribute. Well, I can find elements with Id, tagName, Xpath and all other predefined methods in Selenium. But, I am trying to write a me

4条回答
  •  没有蜡笔的小新
    2020-11-30 04:23

    Use CSS selectors instead:

    List elements = webDriver.findElements(By.cssSelector("*[attributeName='value']"));
    

    Edit: CSS selectors instead of XPath

提交回复
热议问题