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

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

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

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