如何使用selenium java连接到Anti-Detect浏览器(Incogniton)

问题描述 投票:0回答:1

我想连接到这个名为 Incogniton 的特定反检测浏览器的浏览器会话。

它确实支持 selenium 浏览器自动化,但仅支持 python。我对python一无所知,我只了解java。所以我想先手动打开浏览器会话,然后连接selenium来控制驱动程序。

我尝试按照本教程进行操作:https://learn-automation.com/how-to-execute-selenium-scripts-on-already-opened-browser/使用此代码,但没有运气:

import org.openqa.selenium.chrome.ChromeOptions;
import java.io.IOException;

public class selenium {
    public static void main(String[] args) throws InterruptedException, IOException {
        System.setProperty("webdriver.chrome.driver", "C:\\Users\\test\\browser\\117\\win\\chrome.exe"); //this is the dir of the Incogniton's chrome driver

        ChromeOptions options = new ChromeOptions();
        options.setExperimentalOption("debuggerAddress", "127.0.0.1:9222");
        WebDriver driver = new ChromeDriver(options);
        driver.get("https://google.com");
        System.out.println(driver.getTitle());

}}

它给了我这个错误

[4540:3448:0927/210547.993:ERROR:policy_logger.cc(154)] :components\enterprise\browser\controller\chrome_browser_cloud_management_controller.cc(163) Cloud management controller initialization aborted as CBCM is not enabled.

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 

那么我该如何解决这个问题以及如何使用带有selenium的java来控制驱动程序,即使它只支持python?

这里是有关硒自动化的 Incogniton 文档:https://incogniton.com/knowledge%20center/selenium-browser-automation/

java selenium-webdriver webdriver
1个回答
0
投票

@likenzy 我在很多论坛上看到了你的帖子,但你没有在任何地方找到答案:( 这个话题对我来说也很重要,和你一样,我也不懂Python。 请写下您在解决这个问题方面是否取得了任何进展,以及是否有任何进展。 您能给我写信吗?)[电子邮件受保护] 非常感谢

© www.soinside.com 2019 - 2024. All rights reserved.