Closed violinner closed 7 years ago
What is needed to 'test an electron app'? I have no experience with electron.
Based on http://stackoverflow.com/questions/35507295/testing-electron-application-with-org-openqa-selenium-in-a-java-environment-int#answer-35509872 I suppose it is possible using:
|script |map fixture |
|set value |path/to/electron/binary |for|binary |
|set value |!- path-to-electron-app-!|for|args[0]|
|$electronProfile=|copy map |
|script |selenium driver setup |
|start driver for|chrome|with profile|$electronProfile|
I have not tested it, but let me know.
I will try it tomorrow- will definitely report back. Thanks! On Jul 13, 2016 3:58 PM, "Fried Hoeben" notifications@github.com wrote:
Based on http://stackoverflow.com/questions/35507295/testing-electron-application-with-org-openqa-selenium-in-a-java-environment-int#answer-35509872 I suppose it is possible using:
|script |map fixture | |set value |path/to/electron/binary |for|binary | |set value |!- path-to-electron-app-!|for|args[0]| |$electronProfile=|copy map |
|script |selenium driver setup | |start driver for|chrome|with profile|$electronProfile|
I have not tested it, but let me know.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fhoeben/hsac-fitnesse-fixtures/issues/73#issuecomment-232468831, or mute the thread https://github.com/notifications/unsubscribe/ARbJ30w6fh7PUND8sfG9MJneoF_mJhQfks5qVUNqgaJpZM4JKW4C .
Just to be sure: you changed 'path/to/electron/binary' to the electron binary? Because the error message suggests that chromedriver cannot find it? And for completeness 'path-to-electron-app' should be replaced by the path to your app.
Otherwise I have no clue. Like I said I have no experience with electron.
Thanks for your help. I have a stand-alone Java program that does the connection, and I'm looking at a patch to suggest to SeleniumDriverSetup.java to suggest, to be able to animate an electron application.
This code connects through Java and a test can animate an electron application through the returned WebDriver, using org.seleniumhq.selenium, selenium-chrome-driver2.53.1.jar. The arguments are the same as for Spectron (javascript). The version of Selenium appears to be mandatory. Is it necessary to change SeleniumDriverSetup to get this initialization?
public WebDriver setup(String chromeDriverExecutable, String electronAppExecutable) {
System.setProperty("webdriver.chrome.driver", chromeDriverExecutable);
Map<String, Object> chromeOptions = new HashMap<String, Object>();
chromeOptions.put("binary", electronAppExecutable);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("chromeOptions", chromeOptions);
capabilities.setBrowserName("chrome");
return new ChromeDriver(capabilities);
}
I believe the suggestion I posted earlier, should do what you standalone application does, BUT is does one more thing: adding an arg[0]
value to the chromeOptions. If that is not needed we can remove that line.
Have you tried (of course replacing path/to/electron/binary
with the value your program uses for electronAppExecutable
)?
|script |map fixture |
|set value |path/to/electron/binary |for|binary |
|$electronProfile=|copy map |
|script |selenium driver setup |
|start driver for|chrome|with profile|$electronProfile|
The testing project is working with an extended SeleniumDriverSetup.class The scripting-only solution did not give me the ability to send commands to the Chrome frame after it launched.
Is there a SeleniumDriverSetup configuration that can be used to test an electron app with ChromeDriver?