How to get attribute value inside a div in webdriver

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.

Leave a Comment