How to get attribute value inside a div in webdriver

后端 未结 1 1208
再見小時候
再見小時候 2020-12-03 22:24

In the following HTML i need to get the login value using Selenium Webdriver.

相关标签:
1条回答
  • 2020-12-03 23:15
    ieDriver.findElement(By.xpath("//div[@class='assign_grid assign_grid_selected']")).getAttribute("login");
    

    I'd also check to ensure that the locators you are using are only bringing back that one element, and not more - to check this, run the same thing using .findElements and verify only one single result is returned.

    It is common that there are hidden elements in the HTML, and your locator may be picking them up.

    0 讨论(0)
提交回复
热议问题