c# - How to use Selenium to grab nested LinkText? -


i'm using selenium in c# click on link called 'store locator'. current code follows not click on link:

iwebelement storelink = driver.findelement(by.linktext("store locator")); 

here original html, notice there span element nested in tag, not sure if makes difference.

<a href="/site/olspage.jsp?id=cat12090&amp;type=page&amp;rdct=n" data-lid="hdr_stl"><span class="header-icon-storefinder" aria-hidden="true"></span>store locator</a> 

seems link hidden. if selenium finds link not able interact directly. in case javascript option

by xpath = by.xpath("//span[contains(text(),'store locator')]"); iwebelement element = driver.findelement(xpath); ((ijavascriptexecutor)driver).executescript(@"arguments[0].click();",element); 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -