[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:
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
Post a Comment