SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.76k stars 8.2k forks source link

chrome not reachable exception when ExpressVPN is connected #8803

Closed jaspreetsinghrawel closed 4 years ago

jaspreetsinghrawel commented 4 years ago

šŸ› Bug Report

chrome not reachable exception when ExpressVPN is connected.

To Reproduce

Connect the Express VPN All firewalls disabled Run the below code -

from selenium.webdriver.chrome.options import Options from selenium import webdriver driver = webdriver.Chrome(options=options, executable_path='D:/chromedriver_win32/chromedriver.exe')

Expected behavior

driver.get should be successful without any exceptions.

Actual Behavior

Below exception is thrown -

    D:\Assignment>python add_to_cart_v3.py

DevTools listening on ws://127.0.0.1:59948/devtools/browser/b3bea32b-25a1-47ff-800c-162e0200566a
Traceback (most recent call last):
  File "add_to_cart_v3.py", line 67, in <module>
    driver = webdriver.Chrome(options=options, executable_path=r'D:/chromedriver_win32/chromedriver.exe')
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable

Additional Information

When Express VPN is disconnected, everything works fine. Same issue observed in case of Firefox.

Environment

OS: Windows 10 Pro Browser: Chrome, Firefox Browser version: 86.0.4240.75 Browser Driver version: ChromeDriver 86.0.4240.22 Language Bindings version: python 3.6.6 32 bit Selenium Grid version (if applicable): 3.141.0 Express VPN connected

ganeshbch commented 4 years ago

This could be a possible solution when using any VPN's.

Please install webdriver_manager using pip. with webdriver_manager there is no need to download chromedriver it automatically detects your chrome version.

from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(ChromeDriverManager().install(),options=options)
jaspreetsinghrawel commented 4 years ago

This could be a possible solution when using any VPN's.

Please install webdriver_manager using pip. with webdriver_manager there is no need to download chromedriver it automatically detects your chrome version.

from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(ChromeDriverManager().install(),options=options)

This is not working, already tried.

AutomatedTester commented 4 years ago

There is a new API to Options called ignore_local_proxy_environment_variables that will be in the next release that may get around this.

jaspreetsinghrawel commented 4 years ago

@AutomatedTester thank you Sir, appreciate your response.

jaspreetsinghrawel commented 4 years ago

There is a new API to Options called ignore_local_proxy_environment_variables that will be in the next release that may get around this.

Sir when will this next release be available

AutomatedTester commented 4 years ago

The latest release is out now please try and let me know

jaspreetsinghrawel commented 4 years ago

@AutomatedTester Thank you sir, will try with selenium 4.0.0.a7 and let you know.

jaspreetsinghrawel commented 4 years ago

Some more observations here - The reported issue is not seen when using Python 3.8.3 64 bit instead. All other environment parameters same (including the selenium version as 3.141.0)

jaspreetsinghrawel commented 4 years ago

@AutomatedTester Sir, below is my observation with selenium 4.0.0.a7 and python 3.6.8 64 bit. Below error is seen.

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    from selenium.webdriver.chrome.options import Options
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\__init__.py", line 18, in <module>
    from .firefox.webdriver import WebDriver as Firefox  # noqa
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 28, in <module>
    from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
  File "C:\Users\pc\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 23, in <module>
    from contextlib import (contextmanager, asynccontextmanager)
ImportError: cannot import name 'asynccontextmanager'

I saw that asynccontextmanager in python3.6 comes via async_generator library while in the error snippet above it is being expected from contextlib

Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from async_generator import asynccontextmanager
>>>

So please share your inputs about selenium 4.0.0.a7 is wrt which python version.

AutomatedTester commented 4 years ago

The py3.6 issue has been fixed and since you're saying it works in py3.7 I am closing this issue

ickoice commented 4 years ago

It doesn't work with py3.8, I have the same problem, only on Windows, with Cyberghost Vpn. May the OP tell me how he solved it?

jaspreetsinghrawel commented 3 years ago

The py3.6 issue has been fixed and since you're saying it works in py3.7 I am closing this issue

@AutomatedTester Sir, I did not test it on python 3.7. I verified on Python 3.8.3 64 bit as per my earlier comment above