1

I am new to both selenium and python.

I have exported the script from selenium IDE and when i am trying to execute the script in python i am receiving error as below,

EException AttributeError: "'Service' object has no attribute 'log_file'" in <bo
und method Service.__del__ of <selenium.webdriver.firefox.service.Service object
 at 0x0000000002AA4550>> ignored
======================================================================
ERROR: test_sharepoint_python (__main__.SharepointPython)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\scripts\sharepoint python1.py", line 12, in setUp
    self.driver = webdriver.Firefox()
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
line 139, in __init__
    self.service = Service(executable_path, log_path=log_path)
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\service.py", li
ne 45, in __init__
    log_file = open(log_path, "a+")
IOError: [Errno 13] Permission denied: 'geckodriver.log'
----------------------------------------------------------------------
Ran 1 test in 0.030s
FAILED (errors=1)

Please guide me how can i fix this. Have seen other post mentioning update the path of geckodriver. If that fixes the issue let me know where cani find the geckodriver. But i cant view anywhere geckodriver.log Tried downloading and installing geckodriver but exe is not executing

sam
  • 21
  • 4
  • 1
    Possible duplicate of [Permission denied: 'geckodriver.log' while running selenium webdriver in python](http://stackoverflow.com/questions/40466809/permission-denied-geckodriver-log-while-running-selenium-webdriver-in-python) – Andersson Feb 02 '17 at 12:59

2 Answers2

0

There is error: Permission denied: 'geckodriver.log'

  1. Try to find 'geckodriver.log' by: locate geckodriver.log

  2. chmod 777 geckodriver.log

jsonnek
  • 1
  • 1
  • This is not a good idea. Solving a 'permission denied' on a file by just handing everyone all rights to it is hardly a secure solution. – Nelewout Feb 02 '17 at 13:05
  • I have expected this answer, but for test can help. If it is same issue as linked answer it cannot help at all. – jsonnek Feb 02 '17 at 13:22
  • I am using it in windows machine. – sam Feb 03 '17 at 09:26
  • Even after providing full control to the geckodriver.log i am still viewing the same error. – sam Feb 03 '17 at 11:30
  • In my machine path of geckodriver.log is in c:\python27\. Please let me know is it the correct path – sam Feb 03 '17 at 11:32
0

Had same problem, found this: https://github.com/SeleniumHQ/selenium/issues/3128

Using their proposed workaround of constructing webdriver with log_path specified in python script has fixed issue for me. Detail of workaround is:

  1. ensure that OS is in includes
  2. at statement: self.driver = webdriver.Firefox() change to: self.driver = webdriver.Firefox(log_path = os.devnull)

Good news is that the post says it was a bug that has been corrected in more recent versions.

Robert Longson
  • 118,664
  • 26
  • 252
  • 242
Matt
  • 1