Unable to connect to the electron / CEF app using selenium web driver

后端 未结 2 1245
星月不相逢
星月不相逢 2020-12-12 06:23

I am trying to automate [electron-api-demos][1]app using this sample code.

  public static void main(String args[]) throws IOException, InterruptedException          


        
相关标签:
2条回答
  • 2020-12-12 06:46

    check your code again, its pop up error of missing library. check if any resource if missing on directory,

    check your Java annotation if they are missing in your code and Focus on this line

    Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '4.0.0-alpha-3', revision: '8c567de6dc' System info: host: 'INDMRZBK5X95V6G', ip: '192.168.1.5', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_241' Driver info: driver.version: RemoteWebDriver at

    0 讨论(0)
  • 2020-12-12 06:58

    @DebanjanB, Thanks for the help. After I changed the version of the selenium to alpha , I am able to connect to the app with out errors. I am using the following code now :

    public static void main(String args[]) throws IOException, InterruptedException {
            int port = 9223;
            // Open App
    
            Runtime.getRuntime().exec(
                    "C:\\Program Files\\SampleApp.exe", null,
                    new File("C:\\Program Files\\SampleApp"));
    
            ChromeOptions options = new ChromeOptions();
            String remoteDebuggingAddress = "localhost:" + port;
            options.setExperimentalOption("debuggerAddress", remoteDebuggingAddress);
            options.addArguments("remote-debugging-port=9223");
            options.setBinary(
                    "C:\\Program Files\\SampleApp.exe");
    
            System.setProperty("webdriver.chrome.driver",
                    "C:\\Users\\xyz\\eclipse-workspace\\xyz\\src\\demo1\\chromedriver.exe");
            WebDriver driver = new ChromeDriver(options);
            System.out.println(driver.getTitle());
    
        }
    

    The issue is I am not able to access the elements in chromium at http://localhost:9223/ When I open the chromium or chrome browser at teh local host the following text is displayed . Normally a link is expected . Link or the WebElements are not displayed.

    Inspectable WebContents scannerui/appfiles/index.html

    0 讨论(0)
提交回复
热议问题