【发布时间】:2017-03-26 17:54:35
【问题描述】:
我刚开始使用win10学习Django和git。
我使用以下代码创建了一个名为functional_tests.py 的python 文件:
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://localhost:8000')
assert 'Django' in browser.title
当然,当我尝试单独运行这个 pyhton 文件时,会弹出一个带有错误消息的 firefox 窗口
然后,我在 git bash 中执行:
$django-admin.py startproject superlists
$cd superlists
$python manage.py runserver
在另一个命令 shell 中,我这样做:
$python functional_tests.py
我应该会弹出一个 Firefox 窗口,其中包含祝贺我的消息。
相反,没有弹出 firefox 窗口,我有这个错误:
Traceback (most recent call last):
File "functional_tests.py", line 3, in <module>
browser = webdriver.Firefox()
File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 134, in __init__
self.service = Service(executable_path, log_path=log_path)
File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\service.py", li ne 45, in __init__
log_file = open(log_path, "a+")
PermissionError: [Errno 13] Permission denied: 'geckodriver.log'
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.firef ox.service.Service object at 0x03347D10>>
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\selenium\webdriver\common\service.py", lin e 163, in __del__
self.stop()
File "C:\Python34\lib\site-packages\selenium\webdriver\common\service.py", lin e 129, in stop
if self.log_file != PIPE:
AttributeError: 'Service' object has no attribute 'log_file'
我已经在 PATH 中添加了 Firefox 和 geckodriver
【问题讨论】:
标签: python django git selenium