Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Status-Untriaged
New issue 5459 by
vishal...@gmail.com: InvalidSelectorError: The result
of the xpath expression is: [object Text]
http://code.google.com/p/selenium/issues/detail?id=5459
Here is the html source code of the page:
<!DOCTYPE html>
<html>
<body>
<form action="">
<input type="radio" name="sex" value="female">Male<br>
<input type="radio" name="sex" value="male">Female
</form>
<p><b>Note:</b> When a user clicks on a radio-button, it becomes checked,
and all other radio-buttons with equal name become unchecked.</p>
</body>
</html>
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_radio
What steps will reproduce the problem?
1. Open the application using selenium webDriver
FirefoxDriver Browser = new FirefoxDriver();
Browser.get("
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_radio");
2. Read the text/label of the radio button whose html attribute
value="female"
String XPATH = "//input[@value='female']/following-sibling::text()"
String LABEL = Browser.findElement(By.xpath(XPATH)).getText();
3. An InvalidSelectorError exception is raised by WebDriver:
Exception in thread "main" org.openqa.selenium.InvalidSelectorException:
The given selector //input[@value='Red']/following-sibling::text() is
either invalid or does not result in a WebElement. The following error
occurred:
InvalidSelectorError: The result of the xpath
expression "//input[@value='Red']/following-sibling::text()" is: [object
Text]. It should be an element.
This works fine with Selenium IDE and RC but not with WebDriver.
What is the expected output? What do you see instead?
Ideally it should return the label of the radio button
Selenium version: 2.31.0
OS: Windows XP Professional SP2
Browser: FireFox
Browser version: 19.0.2
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings