Re: Driver issue regularly around chrome/webdriver updates

632 views
Skip to first unread message
Message has been deleted

Joshua Trump

unread,
Jun 27, 2023, 9:27:39 AM6/27/23
to ChromeDriver Users
...sorry this is Python w/PyCharm community IDE and Windows OS.

On Tuesday, June 27, 2023 at 8:26:05 AM UTC-5 Joshua Trump wrote:
We have a python script that does some auto login and automation on a web site. It runs perpetually, waits for email, and processes. The author is now a previous employee. 

Occasionally around the time of some combination of chrome and/or webdriver updates it will stop working. Recently it was with Chrome update to 114.0.5735.199. I don't know that we'll be able to get IT to delay or otherwise control this timing, if that would be helpful. Chromedriver currently still showing 5/31 114.0.5735.90 as the latest on downloads page. 

Usually, through some unknown combination of events, this resolves within a day or two. If we check and see a newer webdriver, replacing it usually resolves. 

There is no helpful logging to console when this happens, it seems unable to find the element and just hangs up in the while loop indefinitely:

driver.find_element(By.NAME, 'elementname').send_keys(somekeystrokes)

I can't seem to figure out adding verbose logging effectively, using the mentioned CHROME_LOG_FILE environment variable with service_args=["--verbose", "--log-path=D:\\qc1.log"]) ChromeDriver - WebDriver for Chrome - Logging (chromium.org)

Anyone have suggestions on helping to troubleshoot and possibly prevent this recurring behavior? 

Thanks
jt

Ã̶ḧ̶Ḿ̶ĕ̶đ̶ Å̶ḱ̶ṝ̶à̶ḿ̶

unread,
Jul 1, 2023, 1:04:00 PM7/1/23
to ChromeDriver Users
I also encountered the same problem, but I replaced the old  webdriver  file with the latest version that supports Chrome version 114.

Ã̶ḧ̶Ḿ̶ĕ̶đ̶ Å̶ḱ̶ṝ̶à̶ḿ̶

unread,
Jul 1, 2023, 1:19:21 PM7/1/23
to ChromeDriver Users
It seems like you're experiencing issues with your Python script that performs auto-login and automation on a website, particularly when there are updates to Chrome or the WebDriver. To troubleshoot and potentially prevent this recurring behavior, here are some suggestions:

1. Ensure WebDriver compatibility: Check the compatibility between the version of Chrome you're using (114.0.5735.199) and the corresponding version of the WebDriver. It's important to use a compatible WebDriver version to ensure smooth functioning. You mentioned that the latest WebDriver version available is 114.0.5735.90, so make sure you're using that version.

2. Update WebDriver: Regularly check for updates to the WebDriver and update it accordingly. WebDriver updates often include bug fixes and compatibility improvements, so keeping it up to date can help prevent issues with Chrome updates.

3. Enable verbose logging: To troubleshoot the issue, you can enable verbose logging for Chrome and the WebDriver. Modify your code to include the following options when initializing the WebDriver:

   ```python                                                                                                           
   from selenium import webdriver                                                                  
                                                                                                                               
   chrome_options = webdriver.ChromeOptions()                                         
   chrome_options.add_argument("--verbose")                                             
   chrome_options.add_argument("--log-path=D:\\qc1.log")                     
                                                                                                                               
   driver = webdriver.Chrome(options=chrome_options)                             
   ```
                                                                                                                       

   This will create a log file at the specified path (`D:\\qc1.log`) with detailed information about Chrome's activities. Reviewing this log file can provide insights into any errors or issues encountered by the WebDriver.

4. Check for error messages: Instead of relying solely on console logging, you can capture any error messages or exceptions that occur during the script's execution. Wrap the relevant code block in a `try-except` block and print or log any error messages that are raised. This can help pinpoint the exact cause of the issue.

5. Implement error handling and retries: If the script encounters an error while finding an element, consider implementing error handling mechanisms such as retries with a timeout. You can use the `WebDriverWait` class from the `selenium.webdriver.support.ui` module to wait for the element to be present or visible before interacting with it.

   ```python                                                                                                                    
   from selenium.webdriver.support.ui import WebDriverWait                             
   from selenium.webdriver.support import expected_conditions as EC            
   from selenium.webdriver.common.by import By                                                
                                                                                                                                      
   # Wait up to 10 seconds for the element to be present                                    
   element = WebDriverWait(driver, 10).until(                                                          
       EC.presence_of_element_located((By.NAME, 'elementname'))                  
   )                                                                                                                                  
                                                                                                                                     
   element.send_keys(somekeystrokes)                                                                 
   ```                                                                                                                                


   This way, if the element is not immediately found, the script will wait for a specified duration before raising an exception.

By following these suggestions, you should be able to troubleshoot the issues you're experiencing and potentially prevent them from recurring.

On Tuesday, June 27, 2023 at 4:27:39 PM UTC+3 Joshua Trump wrote:
Reply all
Reply to author
Forward
0 new messages