It might be the case that the button has whitespace or other characters, I would switch to an xpath
selector.
Selecting the u
element
This xpath will select the u
element:
driver.findElement(By.xpath("//button/b/em/u[contains(., 'Next')]"))
Selecting the button
To select the button
containing the above u
element, e.g. so that the button can be clicked:
driver.findElement(By.xpath("//button[b/em/u[contains(., 'Next')]]"))
Xsl fiddle of this here
Element not Found?
As an aside, and in general, when looking at HTML to determine css
or xpath
selectors for Se
, ensure that you are looking at the final rendered version of Html, and not just the original Html served from the web server - client side javascript
may have modified the html significantly after loading, and also note that if the served html was not well formed, that browsers can also change html. In Chrome, I use the Developer tools
: Elements
pane to view html.