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

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -