I am trying to run a selenium test but getting the above error. My geckodriver version is 0.31.0 and firefox browser version is 100 and selenium version is selenium == 4.1.0. Any idea how I can fix this?
below is my conftest.py
import pytest
from selenium import webdriver
from selenium.webdriver.firefox.service import Service as ff_service
options = webdriver.FirefoxOptions()
options.add_argument("--headless")
options.add_argument("--disable-gpu")
driver_path = ff_service(r"/usr/bin/geckodriver")
driver = webdriver.Firefox(service=driver_path,options = options) #getting error at this line
driver.maximize_window()
CodePudding user response:
I met this error as you! I checked my geckdriver.log(in the dir you python you xxx.py) and found the true reason is
XPCOMGlueLoad error for file libgtk-3.so.0: cannot open shared object file: No such file or directory Couldn't load XPCOM.
so you could solve this error through installing libgtk-3