imsardine / winappdriver

WebDriver for Windows Applications
MIT License
119 stars 11 forks source link

Feature/Issue: Support for Electron apps #24

Open Yserz opened 8 years ago

Yserz commented 8 years ago

Hey,

I'm trying to test an Electron covered webapp with the winappdriver. I'm aware that the winappdriver won't let me access the web elements inside of the Electron wrapper but I would like to access things like the menu bar, close, minimize and maximize buttons. I created a simple programm in Java to access a win 7 machine with a running instance of the winappdriver.

public static void main(String[] args) throws MalformedURLException {
        DesiredCapabilities caps = new DesiredCapabilities();
        WebDriver driver = new RemoteWebDriver(new URL("http://<IP>:4444/wd/hub"),caps);
        System.out.println(driver.getPageSource());
}

When I execute the code while the Electron app is in the foreground on the machine running the winappdriver I get the following error in the log:

[Verbose] WinAppDriver: Response (Status: BadRequest, Co
ntentType: text/plain):
System.Windows.Automation.ElementNotAvailableException: Das Zielelement entspricht einer Benutzeroberfläche, die nicht mehr verfügbar ist (z. B., weil das übergeordnete Fenster geschlossen wurde).

Translation: The target element is a UI which is not available anymore e.g. the parent window was closed

I'm able to get the page source for other apps like chrome etc.

Are there any plans to support Electron apps? Can you provide a workaround?