"; org.openqa.selenium.Pr-6ren">
gpt4 book ai didi

java - Selenium 网络驱动程序 : Proxy setting

转载 作者:行者123 更新时间:2023-12-02 07:35:39 26 4
gpt4 key购买 nike

我是 selenium 和 webdriver 的新手,在浏览完之后,我得到了以下用于设置代理并启动浏览器的代码:

String PROXY = "<<MY proxy>>";
org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy();
proxy.setHttpProxy(PROXY);
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.PROXY, proxy);
WebDriver driver = new InternetExplorerDriver(cap);
driver.get("http://www.google.com");
driver.quit();

遇到以下问题:

1) 下面附有错误
2) 我可以从 IE 代理设置中看到我提供的代理字符串存在于“proxy.pac”文件中,但代理不起作用。即使我停止脚本并手动执行
3)当我将代理字符串直接放入浏览器中时,在提供凭据后它可以正常工作。我应该提供凭据吗?您能指导一下如何做吗?

Sep 5, 2012 3:59:52 PM org.openqa.selenium.browserlaunchers.WindowsProxyManager backupRegistrySettings
INFO: Backing up registry settings...
Sep 5, 2012 3:59:53 PM org.openqa.selenium.browserlaunchers.WindowsProxyManager changeRegistrySettings
INFO: Modifying registry settings...
The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see http://code.google.com/p/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://code.google.com/p/selenium/downloads/list
Sep 5, 2012 3:59:54 PM org.openqa.selenium.ie.InternetExplorerDriverServer initializeLib
WARNING: This method of starting the IE driver is deprecated and will be removed in selenium 2.26. Please download the IEDriverServer.exe from http://code.google.com/p/selenium/downloads/list and ensure that it is in your PATH.
Sep 5, 2012 3:59:58 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
INFO: I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond
Sep 5, 2012 3:59:58 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
INFO: Retrying request
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:D:\bin\java_shared\classes;D:\bin\java_shared\classes\jasmine.jar

最佳答案

您读过异常的内容吗?您的问题与代理无关。这是打开 IE 实例的问题。您需要从 Selenium 网站下载 IeDriverServer 并将其路径分配给 webdriver.ie.driver 属性。

您可以在其他主题中阅读更多相关信息:

Driver executable must be set by the webdriver.ie.driver system property

How do I setup the InternetExplorerDriver so it works

关于java - Selenium 网络驱动程序 : Proxy setting,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12279723/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com