使用 selenium webdriver 登录弹出窗口? [英] Login popup window using selenium webdriver?
问题描述
只有在我使用 Fire Fox 浏览器时才会出现弹出窗口,否则有没有办法解决这个问题?每次使用 FF 作为浏览器时,我都必须输入用户名/密码.
the popup window is only happening if I use the Fire Fox browser otherwise, is there a way to fix this problem? I have to enter userid/password every time the i use FF as my browser.
目前,我每次运行测试时都会进入,这非常痛苦,但希望使其更加自动化......
currently, I am entering every time i run my test which is very painful but looking to make it more automated....
I have goggled and found two links here and here but no avail
推荐答案
花了几个小时阅读后,我终于找到了很好的解决方案,我希望这对其他人也有帮助.- 享受!
After spending hours reading I finally found the solution which works pretty well and I hope this will help others too. - Enjoy!!
首先 - 按照以下步骤操作:
First - follow this steps:
1) Open the FireFox browser
2) Type the following `about:config`
3) Look for `network.http.phishy-userpass-length` if you don't find then create a new Integer key
Create a new Integer key (right-click->New->Integer): `network.http.phishy-userpass-length` with value `255`
第二:你需要创建一个Firefox驱动,如下:
Second: You need to create a Firefox driver with the following:
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("network.http.phishy-userpass-length", 255);
profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", "YOUR HOST ADDRESS HERE");
_driver = new FirefoxDriver(profile);
如果您有任何问题,请告诉我.
let me know if you have any questions.
这篇关于使用 selenium webdriver 登录弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!