2

我下载了 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:ininitialize' 来自 /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/common.rb:177:来自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:inrequest' 来自 /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 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:inraw_execute' 来自 /Users/rohit/.rvm/ gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/bridge.rb:92:increate_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从 /Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common/driver.rb:33: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:infor 初始化'来自 /Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver.rb:65:in for' from (irb):5 from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in'

当我使用 "https" 时,我看到以下内容 -

browser = Selenium::WebDriver.for :remote, :url => "https://10.10.10.55:3001/wd/hub", :desired_capabilities => "ipad"

OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 从 /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9 读取服务器 hello A。 1/net/http.rb:678:in connect' from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:678:inblock in connect' 来自 /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:44:in timeout' from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:89:intimeout '来自 /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:678:in connect' from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:637:indo_start' 来自 /Users/rohit/.rvm/rubies/ ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:626:in start' from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:1168:inrequest' 来自 /Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/ selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/http/default.rb:76:inresponse_for' from /Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/http/default.rb:38:in来自 /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 的请求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:inraw_execute' 来自 /Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/bridge.rb:92:increate_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初始化'来自 /Users/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common/driver.rb:33: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:infor' 来自 /用户/rohit/.rvm/gems/ruby-1.9.2-p290@playerTests/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver.rb:65:in for' from (irb):6 from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in'1.9.2p290:007 >

请建议,我做错了什么?

4

1 回答 1

2

为什么 selenium-webdriver 不能在 ipad 上工作:-

  1. 我的 ipad2 版本是 4.3.3,我在同一个 ipad2 上安装了 iWebDriver 项目。
  2. 试图运行有问题的简单 ruby​​ 代码。
  3. 代码出错,堆栈跟踪也有问题。

selenium-webdriver 如何开始在 ipad 上工作:-

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

    ruby 'selenium-webdriver' 驱动程序 = 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 版本依赖关系。

所以,问题是为什么 selenium-webdriver 不能在低于 5.0 的 iOS 版本上运行,比如 4.3.3、4.3.1 等。

感谢所有帮助过我的人。

于 2012-06-28T13:11:01.133 回答