小编Mor*_*ker的帖子

如何在 Java 中从 BotD 中隐藏 Geckodriver 中的 WebDriver?

我按照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)

java selenium webdriver selenium-webdriver geckodriver

8
推荐指数
1
解决办法
2624
查看次数