Using Python Selenium Webdriver to open an Electron application

I am trying to get around using Spectron for End2End testing an electronic application using my experience with Selenium Webdriver in Python. Using a combination of Chromedriver , run a page and some resources that seem to suggest its possible, here is what I came up with:

from selenium import webdriver
import selenium.webdriver.chrome.service as service
servicer = service.Service('C:\\browserDrivers\\chromedriver_win32\\chromedriver.exe')
servicer.start()
capabilities = {'chrome.binary': 'C:\\path\\to\\electron.exe'}
remote = webdriver.remote.webdriver.WebDriver(command_executor=servicer.service_url, desired_capabilities = capabilities, browser_profile=None, proxy=None, keep_alive=False

The problem is that instead of opening an electronic application, it opens a standard instance of Chrome.

Most of the resources that I saw were several years old, so something has changed to make it more impossible.

Does anyone know how to use Python Selenium WebDriver to test an Electron application?

+4
source share
1 answer

Below works fine for me

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()
+4
source

Source: https://habr.com/ru/post/1685269/


All Articles