[org.openqa.selenium.remote.RemoteWebElement@f76d0bdd -> unknown locator] -


i trying read element can later use id of element. using below code first webelement. throws following in console:

"[org.openqa.selenium.remote.remotewebelement@f76d0bdd -> unknown locator]"

webelement ele = driver.switchto().activeelement(); system.out.println("webelement :"+ele); 

you seeing because asking code print ele.tostring().

which, according source, going give exact message see:

https://code.google.com/p/selenium/source/browse/java/client/src/org/openqa/selenium/remote/remotewebelement.java#375

specifically:

public string tostring() {     if (foundby == null) {       return string.format("[%s -> unknown locator]", super.tostring());     }     return string.format("[%s]", foundby); } 

it says 'unknown locator' because 1 isn't explicitly set setfoundby.

so, suggest if want id of element, use:

ele.getattribute("id"); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -