0

I am trying to open up a log in page of a certain website using this code below:

print('Setting up proxy...')
selenium_proxy = webdriver.Proxy()
selenium_proxy.proxy_type = webdriver.common.proxy.ProxyType.PAC
selenium_proxy.proxyAutoconfigUrl = "./proxy.pac/"

print('Setting up headless display...')
global display
display = Display(visible=0, size=(1920, 1080),)

display.start()

print('Setting up profile...')
profile = webdriver.FirefoxProfile()
profile.accept_untrusted_certs = True
profile.set_proxy(selenium_proxy)
caps = DesiredCapabilities.FIREFOX
caps["marionette"] = True
binary = FirefoxBinary('/usr/bin/firefox')

global driver
driver = webdriver.Firefox(firefox_profile=profile, capabilities=caps, firefox_binary=binary, executable_path='/usr/bin/geckodriver', log_path='../Logs/geckodriver.log')
print('Opening browser...')
driver.get(url)

But I always encounter this Exception:

WebDriverException: Message: Reached error page: about:neterror?e=connectionFailure&u=https%3A<url>/account/login%3FloginType%3D&c=UTF-8&d=Firefox%20can%E2%80%99t%20establish%20a%20connection%20to%20the%20server%20at%20<url>

Please note that my code works for some websites.

1 Answers1

0

As you mentioned my code works for some websites, basically when you try to access websites for which you don't have access rights you reach the Network Error Page:

Network Error Page

As the website/application is unreachable you see the error:

WebDriverException: Message: Reached error page: about:neterror?e=connectionFailure&u=https%3A<url>/account/login%3FloginType%3D&c=UTF-8&d=Firefox%20can%E2%80%99t%20establish%20a%20connection%20to%20the%20server%20at%20<url>

References

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352