处理“需要认证".带有Python 2.7 + Selenium Webdriver的警报框 [英] Handling "Authentication Required" alert box with Python 2.7 + Selenium Webdriver

查看:101
本文介绍了处理“需要认证".带有Python 2.7 + Selenium Webdriver的警报框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用安全网址时遇到了问题:

I am having an issue with a secure URL:

打开URL将创建一个需要身份验证"警报框,其中包含用户名和密码字段.

Opening the URL creates an "Authentication Required" alert box with username and password fields.

我对Selenium Webdriver和Python还是陌生的.我不熟悉处理警报,目前正在手动输入凭据,直到我能弄清楚为止. 我已经尝试过将用户名/密码添加到URL中.这对我不起作用.

I am fairly new to Selenium Webdriver and Python. I am not familiar with handling alerts and am currently manually typing in credentials until I can get this figured out. I have already tried adding my username/password into the URL. This does not work for me.

有人可以指出我向在警报框中的用户名和密码字段中输入密钥的方向吗?

Could someone please point me in the direction of entering keys into username and password fields in an alertbox?

推荐答案

感谢所有答复.不幸的是,这些解决方案都不适合我.我怀疑每次webdriver打开firefox时,它可能与创建新的配置文件有关.

Thanks for all of the responses. Unfortunately, none of these solutions worked for me. I suspect it may have something to do with the creation of a new profile every time firefox was opened by webdriver.

我的解决方法: 安装32位IE驱动程序后,我将驱动程序从Firefox更改为IE( http://selenium-release.storage.googleapis.com/index.html?path=2.44/).通过不再创建警报框并允许我继续进行单元测试,这解决了我的问题.

My workaround: I changed the driver from Firefox to IE, after installing the 32bit IE driver(http://selenium-release.storage.googleapis.com/index.html?path=2.44/). This solved my issue by no longer creating the alertbox, and allowing me to continue with my unittest.

这篇关于处理“需要认证".带有Python 2.7 + Selenium Webdriver的警报框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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