selenium中的Python脚本

selenium中的Python脚本,python,selenium,Python,Selenium,我对selenium和python都是新手 我已经从selenium IDE导出了脚本,当我试图用python执行脚本时,我收到如下错误: EException AttributeError: "'Service' object has no attribute 'log_file'" in <bo und method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x000000

我对selenium和python都是新手

我已经从selenium IDE导出了脚本,当我试图用python执行脚本时,我收到如下错误:

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)
EEException AttributeError:“'Service'对象在忽略中没有属性'log\u file'”
======================================================================
错误:测试\u sharepoint\u python(\u主\u.SharepointPython)
----------------------------------------------------------------------
回溯(最近一次呼叫最后一次):
文件“D:\scripts\sharepoint python1.py”,第12行,在安装程序中
self.driver=webdriver.Firefox()
文件“C:\Python27\lib\site packages\selenium\webdriver\firefox\webdriver.py”,
第139行,in_uuuinit__
self.service=service(可执行路径,日志路径=log路径)
文件“C:\Python27\lib\site packages\selenium\webdriver\firefox\service.py”,li
东北45号,初始位置__
日志文件=打开(日志路径,“a+”)
IOError:[Errno 13]权限被拒绝:“geckodriver.log”
----------------------------------------------------------------------
在0.030秒内运行1次测试
失败(错误=1)

请指导我如何解决这个问题。看到其他帖子提到更新geckodriver的路径。如果问题解决了,请告诉我壁虎河在哪里。但是我无法在任何地方查看geckodriver.log尝试下载和安装geckodriver,但exe未执行

出现错误:权限被拒绝:
'geckodriver.log'

  • 尝试通过以下方式查找“geckodriver.log:
    locate geckodriver.log

  • chmod 777 geckodriver.log


  • 出现错误:权限被拒绝:
    'geckodriver.log'

  • 尝试通过以下方式查找“geckodriver.log:
    locate geckodriver.log

  • chmod 777 geckodriver.log


  • 有同样的问题,发现如下:

    使用他们提出的用python脚本中指定的log_路径构建webdriver的解决方法,我已经解决了这个问题。 解决方法的详细信息如下:

  • 确保操作系统处于包含状态
  • at语句:
    self.driver=webdriver.Firefox()
    更改为:
    self.driver=webdriver.Firefox(log\u path=os.devnull)

  • 好消息是,这篇文章说这是一个错误,在最近的版本中已经被纠正。

    也有同样的问题,发现如下:

    使用他们提出的用python脚本中指定的log_路径构建webdriver的解决方法,我已经解决了这个问题。 解决方法的详细信息如下:

  • 确保操作系统处于包含状态
  • at语句:
    self.driver=webdriver.Firefox()
    更改为:
    self.driver=webdriver.Firefox(log\u path=os.devnull)

  • 好消息是,这篇文章说这是一个bug,在最近的版本中已经得到了纠正。

    这篇文章的可能副本不是一个好主意。仅通过向所有人授予文件的所有权限来解决文件上的“权限被拒绝”问题,这并不是一个安全的解决方案。我希望得到这个答案,但对于测试来说可能会有所帮助。如果它与链接的答案是同一个问题,它将毫无帮助。我正在windows计算机中使用它。即使对geckodriver.log提供了完全控制,我仍然看到相同的错误。在我的计算机中,geckodriver.log的路径位于c:\python27\。请让我知道这是正确的路径这不是一个好主意。仅通过向所有人授予文件的所有权限来解决文件上的“权限被拒绝”问题,这并不是一个安全的解决方案。我希望得到这个答案,但对于测试来说可能会有所帮助。如果它与链接的答案是同一个问题,它将毫无帮助。我正在windows计算机中使用它。即使对geckodriver.log提供了完全控制,我仍然看到相同的错误。在我的计算机中,geckodriver.log的路径位于c:\python27\。请告诉我这条路对吗