java - unable to locate href element within a mouse over area - Selenium web driver -
i tried locate link "sign in" located in window appeared when mouse move on "mail" link on yahoo. can xpath using firebug. when used in script, doesn't work.
html snippet :
<a id="yui_3_18_0_4_1456816269995_943" class="c($menulink) fw(b) td(n)" data-ylk="t3:usr;elm:btn;elmt:lgn;" data-action-outcome="lgn" href="login.yahoo.com/config/…; data-rapid_p="23">sign in</a>
i tried in code within main method,
webelement element = driver.findelement(by.id("uh-mail-link")); actions action = new actions(driver); action.movetoelement(element).build().perform(); driver.findelement(by.id("yui_3_18_0_4_1456804882382_929")).click();
id selecter;
driver.findelement(by.id("yui_3_18_0_4_1456804882382_929")).click();
it prompts error;
exception in thread "main" org.openqa.selenium.nosuchelementexception: unable locate element: {"method":"id","selector":"yui_3_18_0_4_1456804882382_929"} command duration or timeout: 17 milliseconds
can locate using id of appeared window ".//*[@id='yui_3_18_0_4_1456804882382_919']" , linktext "sign in", or there other methods locate in script.
you're supposed pass id by.id()
, not xpath expression :
driver.findelement(by.id("yui_3_18_0_4_1456804882382_929")).click();
or use by.xpath()
instead of by.id()
if need find element xpath expression, example, using combination of id
, link text locate target element.
update :
you can filter element text content , id :
//a[@id='yui_3_18_0_4_1456816269995_943' , .='sign in']
Comments
Post a Comment