[英]Testing Electron application with org.openqa.selenium in a Java environment (Intellij)
Is there a way to create automated scenarios using cucumber
and selenium-webdriver
in Java environment for an Electron application?有没有办法在 Java 环境中为 Electron 应用程序使用cucumber
和selenium-webdriver
创建自动化场景?
I found some Node.js
solutions on electron.atom.io , but I would prefer Java.我在electron.atom.io上找到了一些Node.js
解决方案,但我更喜欢 Java。
Thanks.谢谢。
You can use Electron browser with ChromeDriver .您可以使用带有ChromeDriver 的Electron 浏览器。 Try creating WebDriver with similar setup:尝试使用类似的设置创建 WebDriver:
// If chromediver executable is not in your project directory,
// point to it with this system variable
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
Map<String, Object> chromeOptions = new HashMap<String, Object>();
chromeOptions.put("binary", "path/to/electron/binary");
chromeOptions.put("args", Arrays.asList(" path-to-electron-app"));
//eg.: chromeOptions.put("binary", "D:\\electron-quick-start\\node_modules\\electron-prebuilt\\dist\\electron.exe");
// chromeOptions.put("args", Arrays.asList(" D:\\electron-quick-start"));
// for some reason the app arg needs to follow a space on my Windows machine
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("chromeOptions", chromeOptions);
capabilities.setBrowserName("chrome");
WebDriver driver = new ChromeDriver(capabilities);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.