0

My configuration: OS Windows 10, Chrome 103.0, Webdriver 3.8.2, Selenium 4.3.0, Python 3.10.5.

I am learning to use Python Selenium framework. My goal is to automate some repetitive tasks that I perform on a web application inside my intranet. The webapp requests authentication, but as long as I am logged in the Windows domain, the browser recognizes it and automatically does login.

I tried the following snippet of code (TARGET_URL being the url of the page I want to reach):

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get(TARGET_URL)

I have two different results in different scenarios:

  1. remote working: laptop connected to the intranet via VPN. In this case all works well: the Chrome browser is launched and the requested page is opened. I can access the contents via page_source attribute and via find_element method.

  2. working in the office: desktop PC connected to the LAN via Ethernet, so directly into the intranet. In this case I receive a long error message (VS Code says "Output exceeds the size limit. Open the full output data in a text editor"), however the last lines are:

    Max retries exceeded with url: /103.0.5060/chromedriver_win32.zip
    (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002719EE6F3A0>:
    Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
    

Looking for similar threads, I found this one SSL Certificate Verification Failed - When using WebDriverManager in Python Selenium framework and tried the solution n.2, i.e. disable SSL verification in WebDriverManager, but without success.

Is there any other way to get the browser open by Selenium, or at least some plausible reasons for the different behaviours?

Umbomas
  • 1
  • 2
  • Hello @Umbomas and welcome to StackOverflow! It seems like you are downloading `chromedriver` with `webdriver_manager`, and the error shows that the Chrome driver cannot be downloaded because `getaddrinfo failed`. This usually shows that your Internet connection is somewhat faulty - can your office computer download chromedriver directly with no problems? – David Jul 31 '22 at 04:52
  • Also, [this question](https://stackoverflow.com/q/7334199/13951118) has some info about some possible solutions to the `getaddrinfo failed` issue, for example the `http_proxy` or `https_proxy` being configured incorrectly. – David Jul 31 '22 at 04:54
  • Thank you @David for your valuable insights. After a few more tries, I seem to be able to download the chromedriver "manually" while I still can't do it from code. I'm pretty sure it depends on the proxy configuration (it's the most significant difference between the office scenario and the home one), but even trying various settings I haven't come up with it. To get going, I decided to work around the problem: I don't use Webdriver Manager but download chromedriver.exe to a local folder and have Selenium launch the Chrome browser using that driver. In this way, I succeeded. – Umbomas Aug 08 '22 at 18:07

0 Answers0