expecting output Correct mail-id but getting email Adress must be valid why

0 votes
def email_validation(id)   
      mail_id=@driver.find_element(:id,'email')
      mail_id.send_keys(id);
      var=mail_id.attribute('value')
      puts"#{var}"
      wait =Selenium::WebDriver::Wait.new(:timeout=>60)
      if var.empty?
         puts "email can't be empty"
       elsif var =~ /^[A-Z0-9_!#$%&'*+=?{|}^.-]+@[A-Z0-9.-]+\z\i/
             puts "Correct mail-id"
        else puts"email Adress must be valid"
        end
     
  end
 email_validation("ram123@gmail.com")

output:   ram123@gmail.com

            email Adress must be valid    //  why???
            [Finished in 17.1s]
Aug 23, 2023 in Selenium by SEEMA
• 110 points

edited Mar 5 36 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP