我一直在研究Python,Selenium和phantomjs,我遇到了错误
from selenium import webdriver
driver = webdriver.PhantomJS()
driver.get('http://google.com')
for entry in driver.get_log('browser'):
print entry
这是我正在使用的示例代码,问题是它在ubuntu和raspberry pi中完美运行但是当我在Toradex borad(T30)中尝试使用yocto linux时的相同代码。 我收到一条错误说明
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 1238, in get_log
return self.execute(Command.GET_LOG, {'type': log_type})['value']
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response) File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 208, in check_response
raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: Invalid Command Method - Request => {"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"71","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:42648","User-Agent":"Python http auth"},"httpVersion":"1.1","method":"POST","post":"{\"sessionId\": \"db7d3690-6a59-11e8-bf9a-d526e0e5f7cd\", \"type\": \"server\"}","url":"/log","urlParsed":{"anchor":"","query":"","file":"log","directory":"/","path":"/log","relative":"/log","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/log","queryKey":{},"chunks":["log"]},"urlOriginal":"/session/db7d3690-6a59-11e8-bf9a-d526e0e5f7cd/log"}
任何人都可以帮助我或指导我在这个过程中出错的地方。 我正在使用python = 2.7, phantomjs = 1.9.0,selenium = 3.9
我的最终目标是捕获浏览器的控制台日志,任何替代方法对此都非常有帮助,我在树莓派中获得了所需的输出但是我被卡在这里的toradex板中,其中有yocto。