[英]TypeError: __init__() got an unexpected keyword argument 'log_path'
I want to generate screenshot using selenium and phantomjs.This is my code which I am executing from virtualenv (Python 2.7,Windows 8): 我想使用selenium和phantomjs生成屏幕截图。这是我从virtualenv(Python 2.7,Windows 8)执行的代码:
from selenium import webdriver
br = webdriver.PhantomJS(executable_path='C:\phantomjs\phantomjs.exe')
br.set_window_size(1376,768)
br.get('http://www.stackoverflow.com')
br.save_screenshot('screenshot.png')
br.quit()
But I am getting this error: 但我收到此错误:
Traceback (most recent call last):
File "C:\bunker\Lib\site-packages\custom_scn.py", line 58, in <module>
br = webdriver.PhantomJS(executable_path='C:\phantomjs\phantomjs.exe')
File "C:\bunker\Lib\site-packages\selenium\webdriver\phantomjs\webdriver.py", line 49, in __init__
service_args=service_args,log_path=service_log_path)
TypeError: __init__() got an unexpected keyword argument 'log_path'
PhantomJs
is at path C:\\phantomjs\\phantomjs.exe
.How to do debug this :( PhantomJs
位于路径C:\\phantomjs\\phantomjs.exe
。如何调试此:(
尝试将log_path的值设置为:
log_path = os.devnull
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.