处理Windows身份验证在Chrome上弹出 [英] Handle windows authentication pop up on Chrome

查看:496
本文介绍了处理Windows身份验证在Chrome上弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用AutoIt处理Selenium Webdriver脚本的基本身份验证弹出窗口.我为Firefox和Internet Explorer编写了一个脚本,但不适用于Chrome.

I am trying to handle the basic authentication pop up for my Selenium webdriver scripts using AutoIt. I wrote a script for Firefox and Internet Explorer but it doesn't work for Chrome.

当我尝试使用 AutoIt窗口信息工具它是空的.我正在使用以下AutoIt脚本:

When I tried identifying the authentication pop up on Chrome using AutoIt Window Information Tool it came up empty. I am using following AutoIt script:

WinWaitActive("Authentication Required","","120")
If WinExists("Authentication Required") Then
    Send("username{TAB}")
    Send("password{Enter}")
EndIf

任何使它起作用的指针将很有帮助.我没有使用username@password:google.com,因为重定向时会出现一些身份验证弹出窗口.

Any pointers to get this to work would be helpful. I am not using username@password:google.com because some authentication pop ups appear on redirection.

推荐答案

我能够让AutoIt通过文本而不是窗口标题来定位窗口. AutoIt窗口信息工具无法识别标题,但可以识别可见的文本.

I was able to have AutoIt target the window by text, not window title. AutoIt Window Information Tool did not recognize the title but it did recognize the visible text.

所以我将脚本更改为:

WinWaitActive("","Authentication Required","120")
If WinExists("","Authentication Required") Then
    Send("username{TAB}")
    Send("password{Enter}")
EndIf

效果很好.

这篇关于处理Windows身份验证在Chrome上弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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