通过 pytest-selenium 测试电子应用程序

问题描述

我有一个小节点/电子应用程序要测试。

它只是通过“npm start”在本地运行,这会带出一个带有应用程序的小型电子浏览器。

鉴于我没有可提供的网址,我如何使用 pytest-selenium 对其进行测试?

理想情况下,我更喜欢使用 selenium 固定装置。

这是我目前所拥有的。

def test_sanity(install_cbm_dash,install_dir):

    from selenium import webdriver

    # Start the web driver
    web_driver_path = "C:\\webdrivers\\chromedriver.exe"
    service = webdriver.chrome.service.Service(web_driver_path)
    service.start()

    # start the app
    web_driver = webdriver.remote.webdriver.WebDriver(
        command_executor=service.service_url,desired_capabilities={
            'browserName': 'chrome','goog:chromeOptions': {
                'args': [],'binary': "path_to_electron_exe",'extensions': [],'windowTypes': ['webview']},'platform': 'ANY','version': ''},browser_profile=None,proxy=None,keep_alive=False)

这会打开一个电子窗口,但不会打开相关应用程序。如何引导它打开实际应用程序?

我想我需要指定项目本身到电子的路径,但我不知道如何做到这一点。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)