处理“需要认证".带有Python 2.7 + Selenium Webdriver的警报框

编程入门 行业动态 更新时间:2024-10-09 23:17:15
本文介绍了处理“需要认证".带有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( selenium-release.storage.googleapis/index.html?path=2.44/).通过不再创建警报框并允许我继续进行单元测试,这解决了我的问题.

My workaround: I changed the driver from Firefox to IE, after installing the 32bit IE driver(selenium-release.storage.googleapis/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的警报框

本文发布于:2023-11-27 16:22:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1638730.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   Python   quot   Webdriver   Selenium

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!