使用Robot Framework的Selenium2Library测试电子应用

时间:2018-06-22 07:06:25

标签: selenium ubuntu automated-tests electron robotframework

我已经完成了此链接中提供的所有操作-https://spage.fi/electron。首先,我为相应的 Electron 最新的稳定版本和 <<>的正确下载了 Chromedriver em> ubuntu-16.04 (来自此链接-https://github.com/electron/electron/releases)。然后从终端启动 chromedriver

它在 终端

中显示了这样的消息
  

在端口9515上启动ChromeDriver 2.30(7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33)

     

仅允许本地连接。

然后我创建了一个python文件, vars.py ,内容如下:

binary_location = {"chromeOptions": {"binary": "path/to/electron/application"}}

最后创建了Robot Framework测试套件,如下所示:

*** Settings ***

Library      Selenium2Library    run_on_failure=Log Source
Variables    ./vars.py

*** Test Cases ***

Foo
    Create Webdriver    Remote    desired_capabilities=${binary_location}    command_executor=http://localhost:9515
    Sleep    15s
    Click Element    password
    #password is the id of the textfield
    Input Text       password    1234
    [Teardown]    Close All Browsers

当我在 Ride IDE 中运行测试时,测试套件将运行并打开Electron应用程序,并显示该应用程序的首页。但是经过15秒钟的睡眠后,日志显示为

  

:信息:单击元素“密码”。

它继续以这种状态运行,而电子应用中什么也没发生

我不知道为什么它在与电子应用程序相对应的浏览器中完美运行时却没有运行关键字

我再次更改了 vars.py ,如下所示

binary_location = {"browserName": "chrome", "chromeOptions": {"binary": "path/to/electron/application"}}

我从电子文档-https://github.com/electron/electron/blob/master/docs/tutorial/using-selenium-and-webdriver.md

中检查了此链接

我仍然不明白为什么它无法在电子应用程序中运行。 请帮助我运行关键字来测试电子应用程序。甚至可以使用Robot Framework测试电子应用吗?

0 个答案:

没有答案