1

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 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."

4

3 回答 3

1

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.

于 2010-07-12T03:15:03.610 回答
0

Does this work?

br.text_field(:id,"login-popup-user").value=(user)
br.text_field(:id,"login-popup-pswd").value=(pswd)
于 2010-07-15T12:40:35.267 回答
0
  1. Watir 通过 OLE 协议与 IE 一起工作。那就是它不能以与 Firefox 相同的方式工作。您需要 firewatir gem 来使用 Firefox 进行测试。
  2. 我对firewatir没有太多经验。浏览器存在同步问题。我可能猜你有同样的同步问题。
于 2010-07-10T18:33:04.757 回答