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.
Asked
Active
Viewed 360 times
1
-
Is the url a public url? – undetected Selenium Jul 23 '22 at 15:58
1 Answers
1
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

undetected Selenium
- 183,867
- 41
- 278
- 352
-
for my question the URL is 'https://www.google.com/search?q=aircrafts+jongle&rlz=1C1CHBF_enUS985US986&sxsrf=ALiCzsYbdeL-qTiWpKJjzeWFvdclyE9CNA:1658590199885&source=lnms&tbm=isch&sa=X&ved=2ahUKEwiYosT9qY_5AhVspIkEHUewB4AQ_AUoAXoECAEQAw&biw=1536&bih=746&dpr=1.25' . 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 Jul 23 '22 at 19:06
-
-
I updated my question with new images I think it makes my question clear. – Fateme Nazari Jul 23 '22 at 19:22
-