ios - 无法运行 Appium 服务器

标签 ios ruby testing automation appium

我是自动化测试的新手,我想试试 appium。我正在尝试在 ruby​​ 中运行测试脚本,但是我不断收到相同的错误

Users/matt/.rvm/gems/ruby-2.1.2/gems/appium_lib-3.0.3/lib/appium_lib/driver.rb:437:in    rescue in start_driver': ERROR: Unable to connect to Appium. Is the server running?(RuntimeError)from Users/matt/.rvm/gems/ruby2.1.2/gems/appium_lib-.0.3/lib/appium_lib/driver.rb:424:in `start_driver'from   Appiumtest.rb:11:in<main>

当我在浏览器上输入服务器地址 127.0.0.1:4725/wd/hub 时,我得到了

That URL did not map to a valid JSONWP resource

这是我的 ruby 代码:

require 'rubygems'
require 'appium_lib'
capabilities = {
        'appium-version' =>'1.0',
        'platformName'=> 'iOS',
        'platformVersion'=> '7.1',
}

server_url = "http://127.0.0.1:4725/wd/hub"

Appium::Driver.new(caps: capabilities).start_driver
Appium.promote_appium_methods Object

find_element(:xpath,  "//UIAApplication[1]/UIAWindow[2]/UIATableView[1]/UIATableCell[4]").click
driver_quit

对此的任何指示将不胜感激。谢谢!

最佳答案

您是否也在 Appium Server 首选项中使用地址 127.0.0.1:4725? 那里的标准是 0.0.0.0:4723,所以这可能是问题所在。

此外,您可以将路径更改为 server_url = "http://127.0.0.1:4725/wd/hub/"

关于ios - 无法运行 Appium 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24150802/

相关文章:

ruby - 在 Xcode 运行脚本构建阶段使用 rvm 强制指定 Ruby

ios - RKManagedObjectRequestOperation objc_msgSend 期间 RestKit 崩溃

ios - 如何以编程方式将 iAd 横幅添加到屏幕的顶部中央?

javascript - 将 jekyll 标签放入 "onclick"中断处

class_eval 的 Ruby 问题

ios - AppStore verifyReceipt 在沙盒中返回 21007

json - 无法提取响应主体以设置环境变量

c# - 当为 TestFixture 级别而不是测试级别设置作者属性时如何获取它?

ios - 在真实设备上构建有错误

ios - 如何通过cocoapods从github向项目添加特定文件