从命令行使用python,我执行以下命令:
driver = webdriver.Firefox()
driver.get('http://amazon.com/mp3')
el = driver.find_element_by_link_text('MP3 Downloads : MP3 Songs')
el.click()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\selenium-2.19.1-py2.7.egg\selenium\webdriver\remote\webelement.py", line 45, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Python27\lib\site-packages\selenium-2.19.1-py2.7.egg\selenium\webdriver\remote\webelement.py", line 194, in _execute
return self._parent.execute(command, params)
File "C:\Python27\lib\site-packages\selenium-2.19.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 153, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium-2.19.1-py2.7.egg\selenium\webdriver\remote\errorhandler.py", line 147, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: u'current is undefined'
我不知道“当前”是什么...... 我在另一台机器上运行它,错误变成了
...Message u'l is undefined'
有什么建议吗?顺便说一句,这只适用于Firefox上的Windows。
答案 0 :(得分:0)
单击按钮时遇到了同样的问题。
您可以通过发送“空格”字符来点击它:
webDriver.FindElement("button_id").SendKeys(" ");
希望它有所帮助!