Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'watir-webdriver/extensions/alerts'
- class AnatomyOneLogin
- attr_accessor :username, :password
- def initialize(username, password)
- @username = username
- @password = password
- end
- def login
- Watir::Wait.until { $browser.text_field(:id, "username-field").exists? }
- $browser.text_field(:id, "username-field").set($credentials[@username])
- $browser.text_field(:id, "pseudo").click
- Watir::Wait.until { $browser.text_field(:id, "password-field").visible? }
- $browser.text_field(:id, "password-field").set($credentials[@password])
- if @username == "Incorrect Username" || @password == "Incorrect Password"
- $browser.button(:id, "goButton").click
- Watir::Wait.until { $browser.div(:class, "incorrect-inner").visible? }
- else
- $browser.button(:id, "goButton").click
- Watir::Wait.until { $elements["Regional Button"].exists? }
- end
- end
- def local_login
- $browser.goto("#{$env}.anatomyone-int.com/locallogin")
- Watir::Wait.until{ $browser.text_field(:id, "username").exists? }
- $browser.text_field(:id, "username").set("qa.a1")
- $browser.text_field(:id, "password").set("Passw0rd")
- $browser.button(:id, "loginButton").click
- end
- end
Add Comment
Please, Sign In to add comment