1

I was trying to capture or (find the css/xpath) the inline warning message that disappears after few seconds (BTW, I am using Selenium WebDriver / Java for my automation).

eg: In the below public link, I try to click Reset Button without entering any email. The text box briefly shows 'Please fill out this field." I want to automate if it is showing this message as expected.

https://app.shipt.com/password_resets/new

Please help.

PS: I tried to search this website and google but could not find any useful information.

cpro
  • 225
  • 1
  • 2
  • 6

1 Answers1

0

For actions that appear or disappear after certain time you should use Expected Conditions:

 WebDriverWait wait = new WebDriverWait(driver, 10);
 WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("someid")));

And then you can click on element as usual.

However in case of the shipit page you are trying to automate the popup is a native HTML5 popup, so you cannot use Selenium directly to get the message, and you have to use this workaround:

Stackoverflow - how to get HTML5 error message in Selenium

Marcin Natanek
  • 576
  • 3
  • 11