and this fails because the element cannot be found.
2) I try:
List<WebElement> buttons = driver.findElement( By.ByTagName.tagName( "button" ));
for( WebElement button : buttons ) {
if ( button instanceOf RemoteWebElement ) {
RemoteWebElement remoteButton = (RemoteWebElement) button;
if (remoteButton.isDisplayed() && remoteButton.getAttribute( "class" ).equals("xx") ) {
String text = remoteButton.getText();
** text = "Log in".
...
}
}
}
and it works.
Can anyone explain why one works and the other doesn't?
Dave P
List<WebElement> buttons = driver.findElement( By.ByTagName.tagName( "button" ));
should fail because findElement will return a single element. Also, the first one assumes its a link (a tag). In the 2nd one, you are looking for a button tag.
By.linktext is only used for links ( tag=a)
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver.
For more options, visit https://groups.google.com/d/optout.