You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the test, the IP is not a proxy IP,
curl-x http://xxxx:[email protected]:8091 http://httpbin.org/ip indicates that the IP address is inconsistent each time
Then the agent is OK, that is selenium configuration error
What browsers and operating systems are you seeing the problem on?
disposition
My Google is 113.0.5672.93
Google Drive is 113.0.5672.24
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.11.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-devtools-v113</artifactId>
<version>4.11.0</version>
</dependency>
CODE
import org.openqa.selenium.By;
import org.openqa.selenium.Proxy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.CapabilityType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
public class WebDriverManager {
private static final Logger log = LoggerFactory.getLogger(WebDriverManager.class);
private static final String PROXIES_CONFIG = "dtqybf.xiongmaodaili.com:8091";
public static void main(String[] args) {
WebDriver driver = getWebDriver();
driver.get("http://httpbin.org/ip");
WebElement body = driver.findElement(By.tagName("body"));
driver.quit();
}
public static WebDriver getWebDriver() {
System.setProperty("webdriver.chrome.driver", "C:/Users/aa/AppData/Local/Google/Chrome/Application/chromedriver.exe");
// 配置ChromeOptions
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--disable-gpu");
options.addArguments("--remote-allow-origins=*");
options.addArguments("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.5672.92 Safari/537.3");
options.addArguments("--disable-blink-features=AutomationControlled");
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
if (PROXIES_CONFIG != null && !PROXIES_CONFIG.isEmpty()) {
String selectedProxy = "0IWHbXLW:fiUPnLxm@" + PROXIES_CONFIG;
Proxy seleniumProxy = new Proxy();
seleniumProxy.setHttpProxy(selectedProxy);
seleniumProxy.setFtpProxy(selectedProxy);
seleniumProxy.setSslProxy(selectedProxy);
options.setCapability(CapabilityType.PROXY, seleniumProxy);
options.setAcceptInsecureCerts(true);
}
ChromeDriver driver = new ChromeDriver(options);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
return driver;
}
}
The text was updated successfully, but these errors were encountered:
What happened?
What browsers and operating systems are you seeing the problem on?
disposition
CODE
The text was updated successfully, but these errors were encountered: