From 2f9f80193f4bb7218090a94f3616eadb624bb40b Mon Sep 17 00:00:00 2001 From: Nicolas Grosjean Date: Wed, 16 Jun 2021 16:06:15 +0200 Subject: [PATCH] Get more than 400 images Fix clicking on the "Show more results" button with Selenium. - The button has no more "smb" id - We need to do more scroll down before clicking --- google_images_download/google_images_download.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google_images_download/google_images_download.py b/google_images_download/google_images_download.py index 51bb251b..1c5e47d6 100755 --- a/google_images_download/google_images_download.py +++ b/google_images_download/google_images_download.py @@ -292,12 +292,12 @@ def download_extended_page(self, url, chromedriver): element = browser.find_element_by_tag_name("body") # Scroll down - for i in range(30): + for i in range(50): element.send_keys(Keys.PAGE_DOWN) time.sleep(0.3) try: - browser.find_element_by_id("smb").click() + browser.find_element_by_xpath('//input[@value="Show more results"]').click() for i in range(50): element.send_keys(Keys.PAGE_DOWN) time.sleep(0.3) # bot id protection