无法使用selenium webdriver python从safari控制日志

时间:2017-09-18 05:35:25

标签: python selenium selenium-webdriver safari

我正在尝试使用selenium webdriver获取safari的控制台日志。

from selenium import webdriver
import time
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
d = DesiredCapabilities.SAFARI
d['logginfPrefs']={'browser':'ALL'}
driver = webdriver.Safari(desired_capabilities=d)
driver.get("test.com")
time.sleep(10)
driver.find_element_by_xpath("//input[@placeholder='Your Name (Required)']").send_keys("test")
for entry in driver.get_log('browser'):
    print entry
time.sleep(10)

但是得到以下错误

Traceback (most recent call last):
  File "/Users/Fuzebox_6/PycharmProjects/Codechef/test.py", line 14, in <module>
    for entry in driver.get_log('browser'):
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 1053, in get_log
    return self.execute(Command.GET_LOG, {'type': log_type})['value']
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in execute
    self.error_handler.check_response(response)
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 165, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: The command 'POST /session/3A5DB2BA-CE01-4D7C-895E-32F1C3381F7A/log' is not implemented.

有人可以告诉我获取控制台日志所需的标志是什么

0 个答案:

没有答案