久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

無法使用 selenium 網絡驅動程序連接到電子/CEF 應

Unable to connect to the electron / CEF app using selenium web driver(無法使用 selenium 網絡驅動程序連接到電子/CEF 應用程序)
本文介紹了無法使用 selenium 網絡驅動程序連接到電子/CEF 應用程序的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試使用此示例代碼自動化 [electron-api-demos][1]app.

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

  public static void main(String args[]) throws IOException, InterruptedException {
        int port = 9223;// Open App

          Runtime.getRuntime().exec(
          "C:\Program Files\Sample.exe"
          , null, new
          File("C:\Program Files\Sample"
          ));

         ChromeOptions options = new ChromeOptions();
        String remoteDebuggingAddress = "localhost:" + port;
        options.setExperimentalOption("debuggerAddress", remoteDebuggingAddress);
        options.addArguments("remote-debugging-port=9223");

        // options.addArguments("electron-port="+port);
        options.setBinary(
                "C:\Program Files\Sample.exe");

        System.setProperty("webdriver.chrome.driver",
                "C:\Users\narays24\eclipse-workspace\xyz\src\demo1\chromedriver.exe");
        WebDriver driver = new ChromeDriver(options);
        System.out.println(driver.getTitle());

        String location = "C:\Users\narays24\eclipse-workspace\xyz\src\demo1";
        Date now = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");
        String time = dateFormat.format(now);
        File dir = new File(location + time);

        if (!dir.exists())
        {
            dir.mkdir();
        }
        else
        {
            //System.out.println("directory already exists");
            //Do nothing
        }

        File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
        try {
            FileUtils.copyFile(scrFile, new File(location + time + "\screen1.png"));
            }
        catch (IOException e)
             {
              System.out.println(e.getMessage());

             }

    }

我可以訪問該應用程序并獲取屏幕截圖.我無法通過以下端口訪問 cef:

I am able to access the app and get a screenshot. I am not able to access the cef through the below port :

http://localhost:9223/

我在 localhost 得到以下內容,但不是元素:

I am getting the following at the localhost , but not the elements :

可檢查的 WebContents 掃描儀ui/appfiles/index.html

Inspectable WebContents scannerui/appfiles/index.html

誰能幫我理解我哪里出錯了.將 selenium 更改為 alpha 后,我可以毫無錯誤地運行它.

Can anyone help me understand where I am going wrong. After changing the selenium to alpha , I am able to run this with out errors .

更新

我能夠導航到 google 并在 cef 中實現自動化.但我無法控制或對應用程序的菜單欄或按鈕或文本框執行任何操作.

I am able to navigate to google and automate in cef . But I am not able to control or perform any actions on application's menu bar or buttons or text boxes.

我的 cef 基于 chrome 57 .所以我將 chrome 瀏覽器降級為 57 ,將 chrome 驅動程序降級為 2.26 ,將 selenium Java 庫降級為 2.36 .

My cef is based on chrome 57 .so I downgraded the chrome browser to 57 , chrome driver to 2.26 and selenium Java libraries to 2.36 .

我仍然無法單擊桌面應用程序特定的按鈕或文本框.但我能夠驅動程序.導航到谷歌并執行測試.

Still I am not able to click on desktop application specific buttons or text boxes. But am able to driver.navigate to google and perform tests.

有人可以幫忙嗎?我正在使用 Java ,硒

Can anyone help here? I am using Java , selenium

我也試過上面提到的電子申請,還是沒有運氣

I also tried on electron application as mentioned above, still no luck

推薦答案

@DebanjanB,謝謝您的幫助.將 selenium 的版本更改為 alpha 后,我可以無錯誤地連接到應用程序.我現在正在使用以下代碼:

@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());

    }

問題是我無法在 http://localhost:9223/ 訪問 chromium 中的元素當我在本地主機上打開 chromium 或 chrome 瀏覽器時,會顯示以下文本.通常需要一個鏈接.鏈接或 WebElement 不顯示.

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.

可檢查的 WebContents 掃描儀ui/appfiles/index.html

Inspectable WebContents scannerui/appfiles/index.html

這篇關于無法使用 selenium 網絡驅動程序連接到電子/CEF 應用程序的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Upload progress listener not fired (Google drive API)(上傳進度偵聽器未觸發(Google 驅動器 API))
Save file in specific folder with Google Drive SDK(使用 Google Drive SDK 將文件保存在特定文件夾中)
Google Drive Android API - Invalid DriveId and Null ResourceId(Google Drive Android API - 無效的 DriveId 和 Null ResourceId)
Google drive api services account view uploaded files to google drive using java(谷歌驅動api服務賬戶查看上傳文件到谷歌驅動使用java)
Google Drive service account returns 403 usageLimits(Google Drive 服務帳號返回 403 usageLimits)
com.google.api.client.json.jackson.JacksonFactory; missing in Google Drive example(com.google.api.client.json.jackson.JacksonFactory;Google Drive 示例中缺少)
主站蜘蛛池模板: 日韩精品1区2区3区 国产精品国产成人国产三级 | 91久久精品国产 | 国产第一页在线观看 | 久久99精品久久久久久国产越南 | av毛片| 最新黄色在线观看 | 毛色毛片免费看 | 久久精品亚洲精品 | 日韩免费一区 | 国产精品视频久久久 | 精品国产乱码久久久久久丨区2区 | 久久新视频| 久国产视频| 日韩免费一区 | 特黄特色大片免费视频观看 | 精品一区二区三区在线观看 | 久久99久久99久久 | 久久久久久久一区 | 在线国产精品一区 | 国产精品日韩在线 | 国产成人一区二区三区精 | 日本免费小视频 | 久久毛片网站 | 欧美日韩国产不卡 | 精品欧美 | 天天夜碰日日摸日日澡 | 久久av一区二区三区 | 日韩在线不卡 | 在线成人 | 九九在线视频 | 欧美日韩久久久 | 欧美一区二区免费电影 | 午夜免费网| 亚洲福利| 久久国产一区 | 7799精品视频天天看 | 久久精品亚洲 | 黑人巨大精品 | 亚洲国产aⅴ成人精品无吗 亚洲精品久久久一区二区三区 | 91高清在线 | 一区久久 |