我按照Stackoverflow 上的这篇文章禁用了Firefox WebDriver检测。
启动 Geckodriver:
System.setProperty("webdriver.gecko.driver", geckdriverExecutableFilePath);
File firefoxProfileFile = new File(fullPathOfFirefoxInstallationFolder);
FirefoxProfile firefoxProfile = null;
try {
firefoxProfile = new FirefoxProfile(firefoxProfileFile);
} catch (Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
我禁用了WebDriver:
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setProfile(firefoxProfile);
// Disables WebRTC
firefoxProfile.setPreference("media.peerconnection.enabled", false);
Run Code Online (Sandbox Code Playgroud)
我禁用了自动化扩展:
// Disables Automation Extension
firefoxProfile.setPreference("useAutomationExtension", false);
Run Code Online (Sandbox Code Playgroud)
我添加了代理:
DesiredCapabilities dc = DesiredCapabilities.firefox();
Proxy proxy = new Proxy();
proxy.setHttpProxy(ipAddress + ":" + port);
proxy.setFtpProxy(ipAddress + ":" + port);
proxy.setSslProxy(ipAddress + ":" + …Run Code Online (Sandbox Code Playgroud)