2016-11-03 3 views
0

私のアプリケーションでは次のような課題があります。すぐにアプリケーションがCを使用して自動的にFFのブラウザを開きます起動するようすでに開いているFFブラウザのインス​​タンスを作成する可能性はありますか?

:\プログラムファイル\ Mozilla Firefoxの\は

firefox.exeを今私はセレンを使用して開かれたFFウィンドウにインスタンスを作成し、継続したいですさらに。

WebDriver webDriver = null; 
try { 
    URL uri = new URL("localhost:7055/hub"); 
    webDriver = new RemoteWebDriver(uri, DesiredCapabilities.firefox()); 
    System.out.println("Executed on remote driver"); 
} catch (Exception e) { 
    webDriver = new FirefoxDriver(); 
    System.out.println("Executed on New FireFox driver"); 
} 
+0

これまでに何を試しましたか?このリンクをクリックして、明確な質問をする方法を確認してください:http://stackoverflow.com/help/how-to-ask – tR4xX

+0

以下は、リモートWebdriverを使用して試したコードです。 WebDriver webDriver = null; try { URL uri =新しいURL( "http:// localhost:7055/hub"); webDriver =新しいRemoteWebDriver(uri、DesiredCapabilities.firefox()); System.out.println( "リモートドライバで実行"); (例外e) System.out.println( "新しいFireFoxドライバで実行"); } – ADITHYA

+0

追加情報や説明を求めるコメントにはコメントしないでください。投稿を編集してください。 – greybeard

答えて

0

Allow webdriver to attach to a running browserで述べたように:

I'm going to make a call on this one: it's a browser specific feature, and not something 
that we can implement in a general way. With IE, it's possible to iterate over the 
open windows in the OS and find the right IE process to attach to. 

Firefox and Chrome, OTOH, need to be started in a specific mode and configuration, 
which means that just attaching to a running instance isn't technically possible. 

Closing as "not feasible" here as this is a browser specific feature. 

すでにFirefoxブラウザのインス​​タンスを開くためのセレンを添付することはできません。

関連する問題