java - How to find a web element using an href attribute -
it's pretty straight forward. have string contains href value. want find web element on page contains specific href. using:
string href = "http://www.bing.com/images?form=z9lh"; driver.findelement(by.cssselector("a[href*='" + href + "']")).click()
if inspect www.bing.com can see first link "images" on top left has href value set here. when run, says there no such element on page. feel not using correct "find by" option.
this should work you:
driver.findelement(by.cssselector("li#scpt0>a")).click();
Comments
Post a Comment