items = driver.find_elements_by_class_name('gs_or')
for item in items:
title_temp = item.find_element_by_xpath(".//div[2]/h3/a").text
In this case,
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/div[2]/h3/a"}
this error is occurred.
CodePudding user response:
I have checked your code and I think there is one mistake on your expression in xpath. I think you have to erase .
in xpath expression. So ...
title_temp = item.find_element_by_xpath("//div[2]/h3/a").text
This expression will be work, I think.
Hope to be helpful for you. Thanks.