1

を使用して電子アプリケーションのスクリーン ショットをキャプチャできませんjava

これが私のwebdriverセットアップ用のコードです。

ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.setBinary("/Applications/betlite.app/Contents/MacOS/appname");
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
        driver = new ChromeDriver(capabilities);

次の方法を使用して画面をキャプチャすると、従来の方法で機能しますChromeDriver

public static void captureScreenMethod() throws IOException, InterruptedException
    {
        File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
          Thread.sleep(4000);
        FileUtils.copyFile(scrFile, new File("path_of_file/screenshot.png"));
    }

次のエラーが表示されます -

org.openqa.selenium.WebDriverException: 不明なエラー: 不明なエラーから自動化拡張機能を取得できません: ページが見つかりませんでした: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html

MAC OSを使用しています

ありがとう

4

0 に答える 0