Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to connect to a browser session of this specific anti-detect browser called Incogniton.

It does support Selenium browser automation but it only supports Python. I don't know anything about Python and I only have knowledge in Java. So I want to manually open the browser session first, then connect Selenium to control the driver.

I have tried to follow this tutorial: https://learn-automation.com/how-to-execute-selenium-scripts-on-already-opened-browser/ with this code, but no luck:

Java
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());
}}

And it's giving me this error:
[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. <pre>


So how can I fix this problem and how can I use Java with Selenium to control the driver even though it only supports Python?

Here are Incogniton docs about Selenium automation: https://incogniton.com/knowledge%20center/selenium-browser-automation/

What I have tried:

I tried to follow this tutorial: https://learn-automation.com/how-to-execute-selenium-scripts-on-already-opened-browser/ with this code, but no luck.
Posted
Updated 2-Oct-23 3:29am
v3

1 solution

If you have code from a tutorial, but it doesn't work then the best place to start looking for a solution is where you got the tutorial, =not a random website that has never seen the code before.

If nothing else, they need to know there is a problem with their code which needs to be fixed, or with your use of it (which means the tutorial part is flawed and needs fixing).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900