java - FirefoxDriver 不要使用我的代理 (geckodriver)
问题描述
我创建了这段代码,我已经解决了它没有连接到任何网站的问题,(就像打开 Firefox 浏览器但没有打开我想要的任何网站)。
我当前的问题是它不使用给定的代理。
System.setProperty("webdriver.gecko.driver", "C:\\Users\\michi\\Desktop\\insta\\geckodriver\\geckodriver.exe");
String proxy = "88.118.134.214:60737"; //got this from public proxy list
String[] split = proxy.split(":");
String proxy_ip = split[0];
String proxy_port = split[1];
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 1);
profile.setPreference("network.proxy.http", proxy_ip);
profile.setPreference("network.proxy.http_port", proxy_port);
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability(FirefoxDriver.PROFILE, profile);
WebDriver driver = new FirefoxDriver(dc);
driver.get("https://www.wieistmeineip.de/");
Thread.sleep(5000);
driver.quit();
现在有人如何解决这个问题吗?我应该使用其他 WebDriver 还是 smth?
先感谢您!
解决方案
推荐阅读
- postgresql - 如何读取查询参数列表
- go - Golang如何删除静态服务的最后一个斜杠
- oracle - Kafka-connect 无法连接到 oracle 数据库
- python-3.x - 预定义每小时采样的记录数的示例数据框
- forms - “App\Entity\CategoryImage”、“array”类型的预期参数在属性路径“images”处给出
- python - 将循环输出中的所有数字相乘
- install4j - install4j 8 和 mac 公证
- python - Remove an item from a list if it only contains one word
- amazon-web-services - aws - 如何全局设置 aws 编辑器字体大小?
- python - 如果有偶数个项目,如何找到列表的中间值并返回较高的值