Skip to content

Commit

Permalink
added delay in generate_infographics_in_selenium_container after scro…
Browse files Browse the repository at this point in the history
…lling to infographic, to prevent map infographics from being blurry
  • Loading branch information
tkalir committed Jan 2, 2025
1 parent a0b67e9 commit 7d5bff2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions anyway/infographic_image_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
selenium_hub_url = f"https://{selenium_hub_url}/wd/hub"
selenium_remote_results_url = f"https://{selenium_url}/tempdata"
CHROME_PARTIALLY_DOWNLOADED_FILE_EXTENSION = "crdownload"

SLEEP_DURATION_FOR_MAP_TO_HAVE_FOCUS = 5

def create_chrome_browser_session(newsflash_id):
options = webdriver.ChromeOptions()
Expand Down Expand Up @@ -94,7 +94,9 @@ def generate_infographics_in_selenium_container(browser, newsflash_id):
logging.debug(f"found {buttons_found} buttons")
if buttons_found > 0:
for element in elements:
ActionChains(browser).move_to_element(element).click().perform()
ActionChains(browser).move_to_element(element).perform()
time.sleep(SLEEP_DURATION_FOR_MAP_TO_HAVE_FOCUS) #without sleep map infographic may be blurry
element.click()
time.sleep(1) #prevents click arriving before the last finished
is_download_done, generated_images_names = wait_for_folder_to_contain_all_files(newsflash_id,
buttons_found, timeout=60)
Expand Down

0 comments on commit 7d5bff2

Please sign in to comment.