Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Not able to use Remote WebDriver on Kubernetes Cluster #391

Open
tarunmudgal opened this issue Sep 9, 2021 · 1 comment
Open

Not able to use Remote WebDriver on Kubernetes Cluster #391

tarunmudgal opened this issue Sep 9, 2021 · 1 comment

Comments

@tarunmudgal
Copy link

tarunmudgal commented Sep 9, 2021

Hi,

I'm seeing below exception while using Remote WebDriver pointing to selenium hub deployed on a kubernetes cluster. I tried to follow the steps mentioned in #220 but it still does not work. Please check below exception and help me here-

INFO:seleniumwire.storage:Using default request storage
INFO:seleniumwire.backend:Created proxy listening on :::8087
DEBUG:selenium.webdriver.remote.remote_connection:POST http://10.163.46.146:31001/wd/hub/session {"capabilities": {"firstMatch": [{}], "alwaysMatch": {"browserName": "chrome", "platformName": "any", "acceptInsecureCerts": true, "goog:chromeOptions": {"extensions": [], "args": ["--proxy-server=e2e-qe-selenium-hub-service-dev:8087", "--ignore-certificate-errors", "--disable-dev-shm-usage"]}}}, "desiredCapabilities": {"browserName": "chrome", "version": "", "platform": "ANY", "acceptInsecureCerts": true, "goog:chromeOptions": {"extensions": [], "args": ["--proxy-server=e2e-qe-selenium-hub-service-dev:8087", "--ignore-certificate-errors", "--disable-dev-shm-usage"]}}}
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 10.163.46.146:31001
DEBUG:urllib3.connectionpool:http://10.163.46.146:31001 "POST /wd/hub/session HTTP/1.1" 200 995
DEBUG:selenium.webdriver.remote.remote_connection:Finished Request
driver.get("www.google.com")
DEBUG:selenium.webdriver.remote.remote_connection:POST http://10.163.46.146:31001/wd/hub/session/efda77cee3ae3762c5492141633c206a/url {"url": "www.google.com"}
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 10.163.46.146:31001
DEBUG:urllib3.connectionpool:http://10.163.46.146:31001 "POST /wd/hub/session/efda77cee3ae3762c5492141633c206a/url HTTP/1.1" 400 156
DEBUG:selenium.webdriver.remote.remote_connection:Finished Request
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Users/mtarun/OneDrive_VMware_Inc/vmware/code/mangle-yaan-service/venv3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "/Users/mtarun/OneDrive_VMware_Inc/vmware/code/mangle-yaan-service/venv3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/Users/mtarun/OneDrive_VMware_Inc/vmware/code/mangle-yaan-service/venv3.8/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument
  (Session info: chrome=87.0.4280.66)

Below is the code snippet that I used -

from seleniumwire import webdriver
from selenium.webdriver.support.ui import WebDriverWait
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=e2e-qe-selenium-hub-service-dev:8087')
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.set_capability("acceptInsecureCerts", True)
chrome_options.add_argument('--disable-dev-shm-usage')
url="http://<SELENIUM_HUB_URL>:31001/wd/hub"

sw_options = {
    'connection_timeout': None,
    'connection_keep_alive': False,
    # 'backend': 'mitmproxy',
    'suppress_connection_errors': False,  # Show full tracebacks for any connection errors
    'auto_config': False,  # Ensure this is set to False
    'addr': '0.0.0.0',  # The address the proxy will listen on
    'port': 8087,
    #'proxy': {
    #    'http': 'http://e2e-qe-selenium-hub-service-dev:8087',
    #    'https': 'https://e2e-qe-selenium-hub-service-dev:8087',
    #},
}


driver = webdriver.Remote(command_executor=url, desired_capabilities=chrome_options.to_capabilities(), seleniumwire_options=sw_options)

#driver.get("www.google.com")
driver.get("https://www.youtube.com/")

@wkeeling
Copy link
Owner

Thanks for raising this.

Does it make any difference if you comment out this line:

chrome_options.set_capability("acceptInsecureCerts", True)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants