4

我一直在使用SPECTRON的端到端通过利用我与硒的webdriver Python的体验测试的电子申请试图绕过。 使用Chromedriver的组合上手页,和几个resources,似乎暗示其可能的,这是我想出了:使用Python硒的webdriver打开电子申请

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 

的问题是,而不是打开电子应用,它会打开一个镀铬的标准实例。

大多数资源的我见过已有数岁,所以事情可能发生了变化,使其不再可能。

有谁知道的方式来使用Python硒的webdriver测试的电子申请?

回答

4

下面为我的伟大工程

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

显然,我的方式过于复杂了。谢谢! –