在实际设备上使用selenium webdriver自动执行iOS测试

时间:2012-06-19 11:49:29

标签: ios ruby selenium

我下载了iwebDriver项目并将其安装在ipad中。服务器从“http://10.10.10.55:3001/wd/hub”开始。我想点击“www.google.com”,但我收到了错误。我正在粘贴下面的代码和堆栈跟踪。

注意:它在iOS模拟器上运行良好但在ipad上失败。我的iPad版本为4.3.3,XCode版本为4.2,iOS SDK为5.1

require 'selenium-webdriver'

browser = Selenium::WebDriver.for :remote, :url => "http://10.10.10.55:3001/wd/hub", :desired_capabilities => "ipad"
browser.get "http://www.google.com"

我收到错误: -

  

URI :: InvalidURIError:方案http不接受注册表部分:(null):( null)(或错误的主机名?)       来自/Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/generic.rb:199:in initialize' from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/http.rb:78:in initialize'       来自/Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/common.rb:177:in new' from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/common.rb:177:in解析'       来自/Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/common.rb:628:in parse' from /Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/http/default.rb:57:in request'       来自/Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/http/common.rb:40:in {{ 1}} raw_execute”       来自/Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/bridge.rb:92:in {{1} }初始化'       来自/Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common/driver.rb:33:in {{1} }对于'       来自/Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver.rb:65:in call' from /Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/bridge.rb:598:in'

当我使用“https”时,我会看到以下内容 -

create_session'
      from /Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/bridge.rb:68:in
  

OpenSSL :: SSL :: SSLError:SSL_connect SYSCALL返回= 5 errno = 0 state = SSLv2 / v3 read server hello A       来自/Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:678:in new' from /Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common/driver.rb:33:in阻止连接'       来自/Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:44:in for' from (irb):5 from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in timeout'       来自/Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:678:in browser = Selenium::WebDriver.for :remote, :url => "https://10.10.10.55:3001/wd/hub", :desired_capabilities => "ipad" do_start'       来自/Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:626:in connect' from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:678:in request'       来自/Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/http/default.rb:76:in {{ 1}}请求”       来自/Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/http/common.rb:40:in {{ 1}} raw_execute”       来自/Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/bridge.rb:92:in {{1} }初始化'       来自/Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common/driver.rb:33:in {{1} }对于'       来自/Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver.rb:65:in timeout' from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:89:in'1.9。 2p290:007>

请建议,我做错了什么?

1 个答案:

答案 0 :(得分:2)

为什么selenium-webdriver无法在ipad上运行: -

  1. 我的ipad2版本是4.3.3,我在同一个ipad2上安装了iWebDriver项目。
  2. 试图运行简单的ruby代码,写有问题。
  3. 代码出错,堆栈跟踪也有问题。
  4. selenium-webdriver如何开始在ipad上工作: -

    1. 我在'New ipad'ios 5.1版上安装了iWebdriver项目。它也适用于版本为5.0的iphone 4S
    2. 然后运行简单的ruby代码

      红宝石'selenium-webdriver' driver = Selenium :: WebDriver.for:remote,:url => “http://10.10.10.88:3001/wd/hub”,:desired_capabilities => :ipad公司

    3. desired_capabilities没关系,你可以给任何东西:iphone或:ipad

    4. 上面的ruby代码返回了我的对象,我可以这样做: -

      driver.get“http://www.google.com”

    5. 它奏效了。
    6. 我观察到,selenium-webdriver有iOS版本依赖性。
    7. 所以,问题是为什么selenium-webdriver不能在低于5.0的iOS版本上工作,如4.3.3,4.3.1等。

      感谢所有帮助过我的人。