从 selenium-side-runner 传递变量

问题描述

鉴于这个非常简单的 Selenium 测试:

Selenium side script with username and password

如何在使用 selenium-side-runner 运行 .side 项目时提供用户名和密码变量?作为命令行参数,在 .side.yml 配置文件中静态输入或来自外部数据文件。除了在 .side 文件中硬编码用户凭据之外的任何选项。

作为参考,这里是.side文件的内容:

{
  "id": "2fcada56-fdb1-4acd-9d95-451e3d74c8f3","version": "2.0","name": "Todo","url": "https://www.todo-cloud.com/","tests": [{
    "id": "8e83c690-453d-4602-b187-015e9ee4cfe7","name": "Login","commands": [{
      "id": "453101ad-3249-47e9-bc87-860bbfdea343","comment": "","command": "open","target": "https://www.todo-cloud.com/#/welcome/login","targets": [],"value": ""
    },{
      "id": "f14304b6-4f66-4b79-b1a5-39bd206f29af","command": "type","target": "name=username","targets": [
        ["name=username","name"],["css=.ng-valid","css:finder"],["xpath=//input[@name='username']","xpath:attributes"],["xpath=//input","xpath:position"]
      ],"value": "${username}"
    },{
      "id": "a2520d2d-100b-4be4-93f7-d88f3ede804a","target": "name=password","targets": [
        ["name=password",["css=.password",["xpath=//input[@name='password']",["xpath=//div[2]/div/input","value": "${password}"
    }]
  }],"suites": [{
    "id": "31c08a71-044c-4917-87e8-fcaacf3cd7ac","name": "Default Suite","persistSession": false,"parallel": false,"timeout": 300,"tests": ["8e83c690-453d-4602-b187-015e9ee4cfe7"]
  }],"urls": ["https://www.todo-cloud.com/"],"plugins": []
}

解决方法

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

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

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...