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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -