Hi
Take a look at the following html:
<div class="box-content">
<p>
<b>Delivery Time:</b>
N/A
</p>
</div>
I am trying to extract the "N/A" text value so I defined
xpath = //*div[@class='box-content'][1]//*[contains(text(),'Delivery Time')]/following-sibling::text()[1] When I test this xpath with FirePath it recognizes the N/A text.
But when I run the test that tries to obtain that value through RobotFramework and compare it with another string, I obtain the following error:
'The given selector //*div[@class=\'box-content\'][1]//*[contains(text(),\'Delivery Time\')]/following-sibling::text()[1] is either invalid or does not result in a WebElement. The following error occurred:\nInvalidSelectorError: The result of the xpath expression "//*div[@class=\'box-content\'][1]//*[contains(text(),\'Delivery Time\')]/following-sibling::text()[1]" is: [object XrayWrapper [object Text]]. It should be an element.
Stacktrace:
at FirefoxDriver.annotateInvalidSelectorError_ (file:///c:/users/appsca~1/appdata/local/temp/tmp9k18de/webdriver-py-profilecopy/extensions/fxdr...@googlecode.com/components/driver_component.js:8873)
at FirefoxDriver.prototype.findElementsInternal_ (file:///c:/users/appsca~1/appdata/local/temp/tmp9k18de/webdriver-py-profilecopy/extensions/fxdr...@googlecode.com/components/driver_component.js:8931)
at fxdriver.Timer.prototype.setTimeout/<.notify (file:///c:/users/appsca~1/appdata/local/temp/tmp9k18de/webdriver-py-profilecopy/extensions/fxdr...@googlecode.com/components/driver_component.js:396) '
I'm using:
- Firefox 23
- And the latest version of RobotFramework and Selenium Webdriver.
I don't know the origin of the problem, but I hope you guys can help.
Thanks