I'm using Selenium with python to make a spider.
A part of the web page is like this:
<a href="http://www.example.html" target="_blank" class="_j_search_link">text - <span class="sr-keyword">name</span> text</a>
I need to find the href and click.
I've tried as below:
target = driver.find_element_by_class_name('_j_search_link')
target.click()
target is not None
but it doesn't seem that it could be clicked because after target.click()
, nothing happened.
Also, I've read this question: Click on hyperlink using Selenium Webdriver
But it can't help me because in my case, there is a <span class>
, not just a simple text Google
.
driver.find_elements_by_partial_link_text("Wat Chedi Luang").click()