使用Selenium Webdriver.Chrome()控制台会导致异常

Cap*_*eow 3 selenium-webdriver

我正在使用Ubuntu 12.04和Selenium webdriver 2.38.4,Chromium 37.0和chromedriver 2.10.我运行一个基本脚本:

chrome_options = Options()
driver = webdriver.Chrome(chrome_options=chrome_options,
                              executable_path='/usr/bin/chromedriver')
driver.get('http://www.google.com')
Run Code Online (Sandbox Code Playgroud)

一旦我开始环顾Chrome的控制台,我尝试的下一组命令(driver.title, driver.find_element_by_tag_name('body') )将导致:

WebDriverException:消息:u"未知错误:Runtime.evaluate引发异常:TypeError:无法读取属性'click'of null \n(会话信息:chrome = 37.0.2062.94)\n(驱动程序信息:chromedriver = 2.10.267517,platform = Linux 3.5.0-45-generic x86)

谁知道为什么会这样?它每次都很难重新加载,只是为了正常工作.

Ric*_*cif 8

它的发生是因为你的控制台是在浏览器上打开的.只需关闭它,您就不会再看到此错误.