The script from https://www.browserstack.com/automate/python
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
desired_cap = {
'browser': 'Chrome',
'browser_version': '62.0',
'os': 'Windows',
'os_version': '10',
'resolution': '1024x768',
'name': 'Bstack-[Python] Sample Test'
}
driver = webdriver.Remote(
command_executor='http://servinc1:[email protected]:80/wd/hub',
desired_capabilities=desired_cap)
driver.get("http://www.google.com")
if not "Google" in driver.title:
raise Exception("Unable to load google page!")
elem = driver.find_element_by_name("q")
elem.send_keys("BrowserStack")
elem.submit()
print driver.title
driver.quit()
failed with
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='hub.browserstack.com', port=80): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',))
on a system with a localhost HTTP proxy. The proxy is configured with the {http,https}_proxy
environment variables: using requests works:
import requests
r = requests.get('https://api.github.com/events')
and allowing connections to hub.browserstack.com
also works.
The aim is to use BrowserStack with a local proxy. How is this fixed?