Firefox v103.0.2 (current) when initiated with latest GeckoDriver v0.31.0 and Selenium v4.4.0 crashes with NS_ERROR_UNKNOWN_HOST
error as follows:
selenium.common.exceptions.SessionNotCreatedException: Message: Error: NS_ERROR_UNKNOWN_HOST
Code trials:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Log
import sys
print ("Python Version: " +str(sys.version_info))
import selenium
print("Selenium version: " +selenium.__version__)
log = Log()
log.level = "trace"
options = Options()
options.add_argument(log.level)
s = Service('C:\\BrowserDrivers\\geckodriver.exe')
driver = webdriver.Firefox(service=s, options=options)
driver.get('https://www.google.com/')
Console output, traceback and error stacktrace:
Python Version: sys.version_info(major=3, minor=9, micro=0, releaselevel='final', serial=0)
Selenium version: 4.4.0
Traceback (most recent call last):
File "C:\Users\debanjan.bhattacharj\Desktop\Python Programs\Selenium_Firefox_tests.py", line 26, in <module>
driver = webdriver.Firefox(service=s, options=options)
File "C:\Users\user_name\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 177, in __init__
super().__init__(
File "C:\Users\user_name\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 276, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\user_name\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 369, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\user_name\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 434, in execute
self.error_handler.check_response(response)
File "C:\Users\user_name\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Error: NS_ERROR_UNKNOWN_HOST
Stacktrace:
#checkLoadingState@chrome://remote/content/shared/Navigate.jsm:239:28
onStateChange@chrome://remote/content/shared/Navigate.jsm:284:28
Where am I wrong? Anybody facing the same?
selenium.common.exceptions.SessionNotCreatedException: Message: Error: NS_BINDING_ABORTED Stacktrace: #checkLoadingState@chrome://remote/content/shared/Navigate.jsm:216:28 onStateChange@chrome://remote/content/shared/Navigate.jsm:261:28
But when I commented the lineoptions.add_argument(log.level)
, I was able to execute the code without any error. I know the error is not the same as you got, but thought to share it in case it helps you resolve this. – Conventionality