Yon*_*gin 5 python selenium selenium-chromedriver selenium-webdriver electron
我一直试图通过利用我在 Python 上使用 Selenium Webdriver 的经验来绕过使用 Spectron 进行 End2End 测试电子应用程序。结合使用Chromedriver入门页面和一些似乎表明它可能的资源,这就是我想出的:
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
问题是它没有打开电子应用程序,而是打开了 Chrome 的标准实例。
我见过的大多数资源都已经有好几年了,所以可能已经发生了一些变化,使其不再可能。
有谁知道使用 Python Selenium WebDriver 来测试 Electron 应用程序的方法吗?
下面对我很有用
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()
| 归档时间: | 
 | 
| 查看次数: | 2376 次 | 
| 最近记录: |