Background: I have WPF based desktop application under test. The application has few cefglue based browser pages contained within .NET components. I use WinAppdriver for automating WPF based screens and ChromeDriver to automate the browser pages that are contained within WPF based app. I have a challenge to switch to browser pages from WPF screen using chrome driver.

Here is how I launch the WPF based app in java based automation code by specifying the remote debugging port.

    String username = "username";//Dummy detail
    String password="password"; //Dummy detail
    String appName = "TestApp.exe";
    tring command = "powershell.exe -command $securePassword = ConvertTo-SecureString '" + password + "' -AsPlainText -Force ; $credential = New-Object System.Management.Automation.PSCredential '" + username +
                            "', $securePassword ; Start-Process " + appName + "-launcher --remote-debugging-port=5555;" +" -Credential $credential;";
    
Runtime.getRuntime().exec(command);

Here is how I have setup chrome driver to interact with cefglue browser page.

 public ChromeDriver BrowserDriver() {
        try {
            System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe");
            ChromeOptions chromeOptions = new ChromeOptions();
            chromeOptions.addArguments("--no-sandbox");
            chromeOptions.addArguments("--disable-extensions");
            chromeOptions.addArguments("--disable-plugins");
            chromeOptions.setExperimentalOption("debuggerAddress", "127.0.0.1:5555");
            chromeOptions.setBinary("C:\\Program Files\\CefGlue.BrowserSubProcess.exe");
            chromeOptions.addArguments("--user-data-dir=C:\\Users");
            ChromeDriver webDriver = new ChromeDriver(chromeOptions);
            return webDriver;
        }
        catch (Exception ex){
            LOGGER.error("Exception in starting chrome" + ex.getMessage());
            return null;
        }

I get below error:

Exception in starting chromeunknown error: cannot connect to chrome at 127.0.0.1:5555

from chrome not reachable

2023-06-19 10:56:34.780 [main] ERROR - Exception in starting chromeunknown error: cannot connect to chrome at 127.0.0.1:5555

from chrome not reachable

Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'

Driver info: driver.version: ChromeDriver

remote stacktrace: Backtrace:

Ordinal0 [0x009FA113+1548563]

Ordinal0 [0x0097DDA1+1039777]

Ordinal0 [0x008FE32E+516910]

Ordinal0 [0x008F7EBF+491199]

Ordinal0 [0x0088F969+63849]

Ordinal0 [0x0088CDF6+52726]

Ordinal0 [0x0088B203+45571]

Ordinal0 [0x008AB797+178071]

Ordinal0 [0x008AB59D+177565]

Ordinal0 [0x008A95FB+169467]

Ordinal0 [0x0089160A+71178]

Ordinal0 [0x00892690+75408]

Ordinal0 [0x00892629+75305]

Ordinal0 [0x009971B7+1143223]

GetHandleVerifier [0x00A92B46+507814]

GetHandleVerifier [0x00A92864+507076]

GetHandleVerifier [0x00A99F47+537511]

GetHandleVerifier [0x00A93402+510050]

Ordinal0 [0x0098F29C+1110684]

Ordinal0 [0x0099938B+1151883]

Ordinal0 [0x009994F3+1152243]

Ordinal0 [0x009983F5+1147893]

BaseThreadInitThunk [0x773500C9+25]

RtlGetAppContainerNamedObjectPath [0x77497B4E+286]

RtlGetAppContainerNamedObjectPath [0x77497B1E+238]

I strongly suspect the way the remote debugging port in specified in java during app launch. I'm not sure if it is 100% correct. There aren't much details on this. Appreciate any help on this

By the way I'm using chromedriver version 79, as the version of cefglue browser used within my desktop application is v79

0

There are 0 best solutions below