I have a desktop application based on Electron (with Electron we can build cross-platform desktop apps with JavaScript, HTML, and CSS)
Can I test an it using Selenium Library?
I have a desktop application based on Electron (with Electron we can build cross-platform desktop apps with JavaScript, HTML, and CSS)
Can I test an it using Selenium Library?
- Demo
1. Install and start ChromeDriver: we need to download ChromeDriver version which matches what our application uses.
Arguments:
==> After this you should see the first page of your Electron Application pop up!
The options argument can be used to launch Chomium-based applications which utilize the Chromium Embedded Framework . To launch Chomium-based application, use options to define binary_location attribute and use add_argument method to define remote-debugging-port port for the application. Once the browser is opened, the test can interact with the application.
By RobotFramework
Download Chrome Driver. It must be same Chrome version in Electron.
Start chromedriver.exe as a service
***Keywords***
Start WebDriver Service
${port} Convert To Integer ${portNumber}
${service}= Evaluate sys.modules['selenium.webdriver'].chrome.service sys
${service} CallMethod ${service} Service path/to/chromedriver.exe port=${port}
Call Method ${service} start
the ${portNumber}
is a variable for port of ChromeDriver
Start Electron App
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
Call Method ${options} add_argument --remote-debugging-port\=7070
Call Method ${options} add_argument --no-sandbox
${options.binary_location} Set Variable path/to/electron/application
Create WebDriver Remote command_executor=127.0.0.1:${portNumber} options=${options}
then you can run test cases like browser Apps.