简体   繁体   English

TypeError:__init __()获得了意外的关键字参数'log_path'

[英]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.

相关问题 TypeError:__ init __()得到一个意外的关键字参数&#39;log_dir&#39; - TypeError: __init__() got an unexpected keyword argument 'log_dir' 如何修复 protonvpn TypeError: __init__() got an unexpected keyword argument 'log_dir_path'? - How to fix protonvpn TypeError: __init__() got an unexpected keyword argument 'log_dir_path'? TypeError at &#39;&#39; __init__() 得到一个意外的关键字参数 &#39;&#39; - TypeError at '' __init__() got an unexpected keyword argument '' 类型错误:__init__() 得到了意外的关键字参数“名称”-CONVOKIT - TypeError: __init__() got an unexpected keyword argument 'name' - CONVOKIT TypeError:__init __()获得了意外的关键字参数&#39;options&#39; - TypeError: __init__() got an unexpected keyword argument 'options' 类型错误:__init__() 得到了意外的关键字参数“after” - TypeError: __init__() got an unexpected keyword argument 'after' 类型错误:__init__() 得到了意外的关键字参数“i” - TypeError: __init__() got an unexpected keyword argument 'i' Scrapy错误:TypeError:__init __()获得了意外的关键字参数“回调” - Scrapy error: TypeError: __init__() got an unexpected keyword argument 'callback' 类型错误:__init__() 得到了一个意外的关键字参数“family_or_realsock” - TypeError: __init__() got an unexpected keyword argument 'family_or_realsock' Tensorboard TypeError:__ init __()得到一个意外的关键字参数&#39;file&#39; - Tensorboard TypeError: __init__() got an unexpected keyword argument 'file'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM