I'm trying to get XPATH for an error message on github login page.(https://github.com/login). But I can't get XPATH for this element in chrome
I put incorrect credential and saw 'Incorrect username or password' After that:
- I tried to copy XPATH by chrome
$x("//*[@id='js-flash-container']/div/div/text()")but it returned (2) [text, text] $x("//div[contains(text(), 'Incorrect username or password.')]")but it returned nothing
HTML:
<div class="flash flash-full flash-error">
<div class="container">
<button class="flash-close js-flash-close" type="button" aria-label="Dismiss this message">
<svg class="octicon octicon-x" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"></path></svg>
</button>
Incorrect username or password.
</div>
</div>
I need an error message. But I haven't
private By error = By.xpath("//*[@id='js-flash-container']/div/div/text()");