簡體   English   中英

TypeError:__init __()獲得了意外的關鍵字參數'log_path'

[英]TypeError: __init__() got an unexpected keyword argument 'log_path'

我想使用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()

但我收到此錯誤:

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位於路徑C:\\phantomjs\\phantomjs.exe 。如何調試此:(

嘗試將log_path的值設置為:

log_path = os.devnull

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM