Reputation: 1
I am looking for steps to perform e2e testing using selenium, python for electron app.
sample app to create and run in electron, vuejs.
npm install electron --save-dev npm install -g @vue/cli vue create new-app vue add electron-builder
launch app to test:
npm run serve
npm run electron:serve
download chrome driver.
create python (py) with following code:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(executable_path=r'C:/Users/ddd/Downloads/chromedriver_win32/chromedriver.exe')
remote_app = webdriver.remote.webdriver.WebDriver( command_executor=f'http://localhost:9515', desired_capabilities = {'chromeOptions':{ 'binary': 'C:/Users/ddd/source/repos/vueselenium/new-app/node_modules/.bin/electron'}}, browser_profile=None, proxy=None, keep_alive=False)
print("Page Title is : %s" %driver.title) driver.maximize_window() print(driver.title) driver.quit()
Not able to launch the electron app from this python file.
Thanks for your help.
Upvotes: 0
Views: 187
Reputation: 2224
Hello i have some info here linking the way that i do it and also the way that others do it: https://medium.com/@chasethesun/how-to-use-python-selenium-to-test-an-electron-app-ffe01f170ddc
You might want to try this method first. Make sure chromedriver.exe is at the same level as this executor file.
from selenium import webdriver
options = webdriver.ChromeOptions()
options.binary_location = "/Applications/Electron.app/Contents/MacOS/Electron"
driver = webdriver.Chrome(chrome_options=options)
driver.get("http://www.google.com")
driver.quit()
Upvotes: 0