I'm trying to launch it after xvfb-run firefox
but it returns me these mistakes.
When I try to launch it with python3
command it returns me NotADirectoryError: [Errno 20] Not a directory: '/home/druid/.wdm/drivers/geckodriver/linux64/v0.31.0/geckodriver'
Here's a piece of my code: import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.support import expected_conditions as EC
def main():
#options = webdriver.FirefoxOptions()
#options.add_argument("--start-maximized")
driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
CodePudding user response:
First try this and try to run you code again,
sudo apt-get install firefox-geckodriver
If that doesn't work.
You can try to download the gecko driver manually. Then change the directory to the location of where you downloaded it to. Download from here, https://github.com/mozilla/geckodriver/releases unzip. Then change your code to this,
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.support import expected_conditions as EC
def main():
options = webdriver.FirefoxOptions()
#options.add_argument("--start-maximized")
options.add_argument("--headless")
driver = webdriver.Firefox(executable_path='/home/druid/path/to/geckodriver', options=options)
Your executable path is where you placed the geckodriver executable.