mercredi 3 février 2016

How to assert/verify tests using Selenium

How would I check to see if the correct text was input into the text box?

My code is:

element = driver.find_element :id => "gmail-sign-in"
element.click

element = driver.find_element :id => "Email"
element.send_keys "exampletestemail2903@gmail.com"


input = wait.until {
  element = driver.find_element :id => "Email"
  element if element.displayed?
}
input.send_keys("exampletestemail2903@gmail.com")
if input == "exampletestemail2903@gmail.com"
  puts 'Correct Input'
else
  puts 'Wong Input'
end

For example, I have this to check if the input text is correct, however, it prints the else message even though the input is correct.

Can someone explain why?

Aucun commentaire:

Enregistrer un commentaire