2016-11-03 2 views
0

Ich habe die folgende Herausforderung in meiner Anwendung.Gibt es in Selen eine Möglichkeit, eine Instanz für einen bereits geöffneten FF-Browser zu erstellen?

sobald die Anwendung gestartet wird es automatisch einen FF-Browser öffnen C mit: \ Programme \ Mozilla Firefox \ firefox.exe

Jetzt i eine Instanz mit dem geöffneten Fenster FF mit Selen erstellen möchten und weiterhin des Weiteren.

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

Was haben Sie bisher versucht? Bitte überprüfen Sie diesen Link, um eine klare Frage zu stellen: http://StackOverflow.com/Help/how-to-ask – tR4xX

+0

unten ist das Code-Snippet ausprobiert mit Remote-Webdriver WebDriver webDriver = null; versuchen { URL uri = neue URL ("http: // localhost: 7055/Hub"); webDriver = neuer RemoteWebDriver (uri, DesiredCapabilities.firefox()); System.out.println ("Auf Remote-Treiber ausgeführt"); } catch (Ausnahme e) { webDriver = new FirefoxDriver(); System.out.println ("Auf neuem FireFox-Treiber ausgeführt"); } – ADITHYA

+0

Kommentieren Sie keine Kommentare, in denen Sie nach zusätzlichen Informationen oder Erläuterungen gefragt werden: Bearbeiten Sie stattdessen Ihren Beitrag. – greybeard

Antwort

0

Wie in Allow webdriver to attach to a running browser erwähnt:

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. 

Es ist nicht möglich Selen anhängen geöffnet Beispiel Firefox bereits Browser.

Verwandte Themen