简体   繁体   中英

electron, Vuejs app not launched e2e selenium, python

I am looking for steps to perform e2e testing using selenium, python for electron app.

  1. 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

  2. download chrome driver.

  3. 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.

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM