Permission denied: geckodriver.log while running selenium webdriver in python

I installed Firefox and Selenium on centos. I use Xvfb and pyvirtualdisplay to open a browser.

When I try to run selenium webdriver, I can open a new screen, but as soon as I do

browser = webdriver.Firefox()

I get an error message:

File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 134, in __init__
    self.service = Service(executable_path, log_path=log_path)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/service.py", line 45, in __init__
    log_file = open(log_path, "a+")
IOError: [Errno 13] Permission denied: 'geckodriver.log'

Any clues on what's going wrong here?

EDIT: after overcoming the permission error, I get

Message: 'geckodriver' executable needs to be in PATH

+6
source share
5 answers

Apparently, this may be due to incompatibilities between your firefox and your Selenium. Try it pip install --upgrade selenium, and if the error still exists, try downloading a different version of Firefox or the gecko driver .

Regarding the post:

'geckodriver' executable needs to be in PATH

script:

ff_profile_dir = "/usr/local/selenium/webdriver/firefox"
ff_profile = selenium.webdriver.FirefoxProfile(profile_directory=ff_profile_dir)
driver = selenium.webdriver.Firefox(ff_profile)

, , Unix- bash - :

export PATH=$PATH:/path/to/directory/of/executable/downloaded/in/previous/step

Windows Path, geckodriver line ( geckodriver PATH, ). Unix.

+2

. , . , . , Selenium, . script, , .

, "geckodriver.log" , script. . geckodriver.log C:\Program Files\Python36, Selenium Firefox .

+2

. Python script Windows Notepad++. geckodriver.exe PATH C:\Python 27. Firefox. Selenium, geckodriver Firefox .

, geckodriver.log:

C:\Program Files (x86)\Notepad++\geckodriver.log

, Notepad++ . , . Windows ( ).

Notepad ++, .

+1

. Pypi. "" geckodriver, geckodriver, .

, , geckodriver.exe C:\Program Files\Python37 (Python37 PATH). .

0

geckodriver.log , root, , , python, .

0

Source: https://habr.com/ru/post/1694574/


All Articles