appium - 尝试通过 Appium 运行我的第一个 ruby 测试
问题描述
我已成功安装 Appium 并更新了以下 ruby gem:
$ gem update --system $ gem update bundler
并为 ruby 安装了以下 gem:
gem 卸载 -aIx appium_lib gem install --no-rdoc --no-ri appium_lib
这是我的第一个红宝石测试:
require 'rubygems'
require 'appium_lib'
APP_PATH = appAddress
desired_caps = {
caps: {
platformName: iOS,
platformVersion: 11.4,
deviceName: iPhone 7,
app: APP_PATH,
automationName: XCUITest,
},
appium_lib: {
sauce_username: nil,
sauce_access_key: nil,
wait: 60
}
}
# Start the driver
Appium::Driver.new(desired_caps, true).start_driver
module DataSiteOne
module iOS
#prints statement
puts "Entered into this test!"
#Quit when you're done!
driver_quit
puts "First Tests Succeeded!"
end
end
从终端启动 appium 然后运行我的第一个 ruby 测试后,我收到以下错误消息。
require 'rubygems'
^^^^^^^^^^
SyntaxError: Unexpected string
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile (internal/modules/cjs/loader.js:670:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
at startup (internal/bootstrap/node.js:238:19)
解决方案
最初我用 javascript 编写了我的测试,因此我使用了以下命令:
节点“你的项目名称”
在终端中启动 appium 后,运行以下命令来运行您的 ruby 测试文件: ruby "fileName"
推荐阅读
- python - 如何使用部分字符串进行搜索以搜索具有字符串参数的对象列表并在 Python 中找到我要查找的对象?
- html - 使标签向右浮动并垂直居中
- javascript - 如何防止表单提交?
- python - 如何在 Python 中通过它创建自定义日历和索引?
- python - 我在执行异常值检测功能时得到了不希望的输出。代码如下
- node.js - Electron 桌面应用程序与远程 NoSql 服务器通信
- c++ - 如何遍历字符串并转换为小写?
- docker - 当我通过 vim 而不是 docker 容器 ubuntu18.04 上的“crontab -e”编辑 crontab 时,crontab 任务不起作用
- scikit-learn - AWS Sagemaker scikit_bring_your_own 示例
- python - HTML 页面无法使用 FLASK 查看 - 出现 404 错误