When using Selenium I tried to scroll down the page but I don't know how to click on the link with text See more anyway.
1 Answer
To click on the element with text See more anyway you need to induce WebDriverWait for the element_to_be_clickable() which automatically scrolls the element within view and you can use the following locator strategy:
Using XPATH:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[contains(., 'The rest of the results')]//span[contains(., 'See more anyway')]"))).click()Or simply:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//span[contains(., 'See more anyway')]"))).click()Note: You have to add the following imports :
from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC
4 Comments
Fateme Nazari
for my question the URL is 'google.com/…' . using your code I got error. I think this is because there is not any button. could you please let me know how to fix it. Do I have to edit anythings?
Fateme Nazari
the error is InvalidSelectorException .
Fateme Nazari
I updated my question with new images I think it makes my question clear.
undetected Selenium
Checkout the updated answer and let me know the result.

