无法播放硒中记录的测试用例

时间:2018-07-05 05:13:46

标签: selenium-webdriver selenium-chromedriver selenium-ide

我正在尝试通过使用硒模拟janus视频通话的登录(注册)测试。当我播放记录的测试用例时,无法在建议的文本区域中输入用户ID。现在,我得到了“元素当前不可交互并且可能无法操纵”

Access link: https://janus.conf.meetecho.com/videocalltest.html.

日志如下。

1。在/videocalltest.html上打开...确定

2.clickAt on id =开始于值37,11 ...确定

3.clickAt在id = username上,值为217,25 ...确定

4.type在id = username上的值为priyaranjan ...失败: 元素当前不可交互,可能无法操作

请建议如何解决此问题,以使用硒模拟注册测试用例。

1 个答案:

答案 0 :(得分:0)

test page上,各种按钮一直存在,仅hidden。 =>您需要使用waitForVisible,因此IDE会等到它们可见并准备接收输入为止。

这是我的测试用例,它使用waitForVisible并起作用:

{
  "CreationDate": "2018-7-5",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://janus.conf.meetecho.com/videocalltest.html",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=start",
      "Value": ""
    },
    {
      "Command": "waitForVisible",
      "Target": "id=username",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=username",
      "Value": "stackoverflowuser123"
    },
    {
      "Command": "waitForVisible",
      "Target": "id=register",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=register",
      "Value": ""
    },
    {
      "Command": "waitForVisible",
      "Target": "id=peer",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=peer",
      "Value": "12345678"
    },
    {
      "Command": "waitForVisible",
      "Target": "id=call",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=call",
      "Value": ""
    }
  ]
}

该测试用例是用Kantu Selenium IDE记录的。在那里,您只需将此代码粘贴到其“源(JSON)”标签中即可。

enter image description here