2017-12-01 7 views

答えて

0

あなたがChromeDriverをインスタンス化すると、以下のコードを使用してみてください:

ChromeOptions options = new ChromeOptions(); 
options.addExtensions(new File("/path/to/extension.crx")); 
DesiredCapabilities capabilities = new DesiredCapabilities(); 
capabilities.setCapability(ChromeOptions.CAPABILITY, options); 
ChromeDriver driver = new ChromeDriver(capabilities); 
+0

コードがありますが、拡張機能設定にアクセスできません。私は拡張からいくつかのオプションをオンに切り替える必要があります。 – raj

+0

@rajサンプルコードスナップを追加できますか?実際に何を試しましたか? –

+0

//System.setProperty("webdriver.chrome.driver "、"/Users/Documents/chromedriver "); driver =新しいChromeDriver(); ChromeOptions options =新しいChromeOptions(); options.addExtensions(新しいファイル( "Switch.crx")); DesiredCapabilities caps = DesiredCapabilities.chrome(); caps.setCapability(ChromeOptions.CAPABILITY、options); ドライバ=新しいChromeDriver(上限); LoggingPreferences logPrefs =新しいLoggingPreferences(); logPrefs.enable(LogType.BROWSER、Level.ALL); caps.setCapability(CapabilityType.LOGGING_PREFS、logPrefs);} exntion設定をオンにした後、すべてのログを取得したいと思います。 – raj

関連する問題