79378742

Date: 2025-01-22 17:47:46
Score: 1.5
Natty:
Report link

I've been able to develop a workaround for this issue using the following line of code

self.webdriver.command_executor._client_config._timeout = 10000

With that being said, I recognize that it's not proper to access the '_timeout' variable directly (which is an element of the "ClientConfig" class in Selenium. I would welcome any thoughts on how to correctly implement this fix. Revised code below:

from selenium import webdriver
from selenium.webdriver.common.by import By
import time, glob, os, zipfile
from url_destinations import url_destinations

target_data = url_destinations["OTP"]

# Selenium Code to Initiate Download
chrome_options = webdriver.ChromeOptions()

prefs = {"download.default_directory": r"C:\Users\<hidden>\data\downloads"}
chrome_options.add_experimental_option("detach", True)
chrome_options.add_experimental_option("prefs", prefs)

driver = webdriver.Chrome(options=chrome_options)
self.webdriver.command_executor._client_config._timeout = 10000

latest_data = driver.find_element(By.ID, value="lblLatest").text

for val in target_data["Check Options"]:
    selected_item = driver.find_element(By.ID,value=val)
    selected_item.click()

# Wait for Download to Complete
while len(glob.glob(prefs["download.default_directory"]+"\*.tmp")) > 0:
    time.sleep(0.5)
Reasons:
  • Blacklisted phrase (1.5): any thoughts
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Michael Koehler