Problem between IE and FF testing a login
This is so simple that I am stunned it is failing. I am testing a very simply login sequence and essentially my code does this:
require "watir"
user = "allqax+beta1@gmail.com"
pswd = "qwerty"
br = Watir::Browser.new
br.goto("http://mysite.com")
br.link(:id,"login-menu").click # click the login menu
br.text_field(:id,"login-popup-user").set(user) # enter the username
br.text_field(:id,"login-popup-pswd").set(pswd) # enter the password
br.link(:id,"login-popup-signin-button").click # click the submit link
When I run this (which runs it in IE), it works fine.
When I add the following line right after the "require" statement:
Watir::Browser.default = "firefox"
it now goes to Firefox 3.6, but when it enters the username, it only types in the first 8-12 characters 开发者_StackOverflow社区and then stops. As a result, the login fails ("invalid email address" is the most common message).
I also tried changing this to use FireWatir but it failed in precisely the same way.
Any ideas? HELP! (And thanks so much in advance!)
Best regards,
Jon Rosen
"Sometimes you're the pinball wizard, and sometimes, you're just the pinball."
Your code looks good to me. I have similar code that works with both Firefox and IE. It is possible that you are running into a javascript issue with the particular page you are testing.
- Watir works with IE through OLE protocol. That is it cannot work the same way with Firefox. You need firewatir gem to test with Firefox.
- I didn't have much experience with firewatir. There were synchronization problems with browser. I may guess you have the same sync problems.
Does this work?
br.text_field(:id,"login-popup-user").value=(user)
br.text_field(:id,"login-popup-pswd").value=(pswd)
精彩评论