处理使用Selenium浏览器认证 [英] Handling Browser Authentication using Selenium

查看:350
本文介绍了处理使用Selenium浏览器认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道怎样处理使用硒或自动化过程中任何其他工具浏览器验证?

Does anyone know about handling Browser Authentication using Selenium or any other tool during automation?

推荐答案

这答案是过时的。时下的webdriver支持验证!见<一href=\"http://stackoverflow.com/questions/24304752/how-to-handle-authentication-popup-with-selenium-webdriver\">How办理认证弹出硒的webdriver

EDIT in 2015:

This answer is outdated. WebDriver nowadays supports authentication! See How to handle authentication popup with Selenium Webdriver

这不是由硒处理得很好。

This is not handled very well by Selenium.

您可以尝试使用的http://用户名:password@example.com/yourpage

而不仅仅是 http://example.com/yourpage

不过,据我所知,火狐仍然会弹出一个浏览器对话框,要求确认。

However, as far as I know, Firefox will still pop up a browser dialog requesting a confirmation.

您可以尝试机器人如果你使用的是Java(或任何类似的工具,如 AutoIt的)。

You can try Robot if you're using Java (or any similar tool like AutoIt).

您可以使用<一个href=\"http://selenium.google$c$c.com/svn/trunk/docs/api/java/org/openqa/selenium/WebDriver.Options.html#addCookie%28org.openqa.selenium.Cookie%29\"><$c$c>driver.manage().addCookie()如果你使用的webdriver。

You could use driver.manage().addCookie() if you're using WebDriver.

或自定义的<一个href=\"http://selenium.google$c$c.com/svn/trunk/docs/api/java/org/openqa/selenium/firefox/FirefoxDriver.html#FirefoxDriver%28org.openqa.selenium.firefox.FirefoxProfile%29\">FirefoxProfile一个已经通过认证一次。

Or a custom FirefoxProfile that has already passed the authentication once.

这篇关于处理使用Selenium浏览器认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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