Selenium Webdriver-如何将代理设置为“自动检测".对于Firefox [英] Selenium Webdriver - How to set proxy to "auto-detect" for Firefox

查看:274
本文介绍了Selenium Webdriver-如何将代理设置为“自动检测".对于Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的脚本在chrome和IE上运行良好,但是由于firefox为其代理设置设置了手动",因此无法在firefox上启动.如何将其设置为自动检测"?

My scripts are running fine on chrome and IE but won't start on firefox due to firefox having "manual" set for its proxy settings. How can I set this to "auto-detect"?

请使用C#中的源代码.

Source code in C# please.

谢谢

推荐答案

感谢您的帮助AJ.

我使用以下代码解决了我的问题:

I used the following code to solve my problem:

FirefoxBinary binary = new FirefoxBinary("C:\\Program Files\\Mozilla Firefox\\firefox.exe");
FirefoxProfile profile = new FirefoxProfile("C:\\test profile\\");          driver = new FirefoxDriver(binary, profile);

我只是将Mozilla配置文件的内容复制到了"c:\test profile\".这使我可以通过Selenium运行测试,还可以使其他firefox实例保持打开状态.

I simply copied the contents of my Mozilla profile to "c:\test profile\". This allowed me to run the test via Selenium but also keep other firefox instances open.

这篇关于Selenium Webdriver-如何将代理设置为“自动检测".对于Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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