尝试在机器人框架中识别Web元素时出现InvalidSelectorException

时间:2016-02-19 12:23:12

标签: xpath robotframework

  

ign-In |失败|   InvalidSelectorException:消息:给定的选择器xpath = //*[@id='user_email']无效或不会产生WebElement。发生以下错误:   InvalidSelectorError:由于以下错误,无法找到xpath表达式xpath = //*[@id='user_email']的元素:   TypeError:无法转换表达式以返回指定的类型。   堆栈跟踪:       在FirefoxDriver.annotateInvalidSelectorError_(file:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver@googlecode.com/components/driver-component.js:10633)       在FirefoxDriver.prototype.findElementsInternal_(file:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver@googlecode.com/components/driver-component.js:10691)       在FirefoxDriver.prototype.findElements(file:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver@googlecode.com/components/driver-component.js:10695)       在DelayedCommand.prototype.executeInternal_ / h(file:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver@googlecode.com/components/command-processor.js:12534)       在DelayedCommand.prototype.executeInternal_(file:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver@googlecode.com/components/command-processor.js:12539)       在DelayedCommand.prototype.execute /< (文件:///var/folders/5f/6mvs5x1j37s5q3_38kjfwkgr0000gn/T/tmp1Nrpuj/webdriver-py-profilecopy/extensions/fxdriver@googlecode.com/components/command-processor.js:12481)

1 个答案:

答案 0 :(得分:0)

错误消息的这一部分解释了原因:

  

给定的选择器xpath = //*[@id='user_email']无效或不会产生WebElement

在这种情况下,//*[@id='user_email']是有效的XPath表达式,因此它必须不是该XPath匹配的元素。我从所提供的信息中可以看出这一切。