如何使用watir在弹出窗口中输入密码? [英] How to enter password in a popup using watir?

查看:85
本文介绍了如何使用watir在弹出窗口中输入密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一些watir测试用例:

I'm writing some watir test cases:

browser.goto "http://egauge2592.egaug.es/"
browser.link(:href,"/settings.html").click
browser.text_field(:index,4).set("some text")
browser.button(:id,"save_button").click

然后打开需要身份验证"对话框,询问用户名和密码.

then a 'Authentication Required' dialogue opens, asking for username and password .

无论我怎么尝试,我都无法访问文本字段.

No matter how I tried, I couldn't access the text fields.

我尝试了send_keys和JavaScript.

I tried send_keys and JavaScript.

我也尝试过Watir.autoit,但是它说的是未定义的方法.

I also tried Watir.autoit but it says undefined method.

我正在使用带有FireFox浏览器的Ubuntu计算机上的watir.

I'm using watir on a Ubuntu machine with the FireFox browser.

如何填写该对话框的用户名和密码字段? 我可以通过browser.alert.set输入用户名,但只能设置用户名无法访问密码字段.

How to fill in username and password fields of that dialogue box? I was able to enter username with browser.alert.set but could only set username couldn't access password field.

推荐答案

我改用watir-webdriver,它(http://watirwebdriver.com/basic-browser-authentication/)对我有用.

I use watir-webdriver instead and this (http://watirwebdriver.com/basic-browser-authentication/) works for me.

这篇关于如何使用watir在弹出窗口中输入密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆