我已经在那里设置了我的葫芦 android,它工作正常。现在我必须添加一个场景,在 android 模拟器中我需要打开默认浏览器导航到一个 url(即https://def/l/abc)假设应用程序已经安装,它将打开应用程序。然后我可以登录应用程序并继续前进。我如何通过 calabash 自动执行此操作。特别是打开浏览器并单击链接。假设我的模拟器已经打开。我发现了类似的东西
require 'selenium-webdriver'
caps = Selenium::WebDriver::Remote::Capabilities.android
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 480
driver = Selenium::WebDriver.for(
:remote,
:http_client => client,
:desired_capabilities => caps,
)
driver.navigate.to "http://www.google.com"
element = driver.find_element(:name, 'q')
element.send_keys "Hello WebDriver!
但是它总是给出错误
ruby test.rb
/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:878:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
from /Users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:878:in `open'
from /Users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
from /Users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
from /Users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:877:in `connect'
from /Users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
from /Users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:851:in `start'
from /Users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:1367:in `request'
from /Users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/remote/http/default.rb:107:in `response_for'
from /Users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/remote/http/default.rb:58:in `request'
from /Users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
from /Users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/remote/bridge.rb:657:in `raw_execute'
from /Users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/remote/bridge.rb:122:in `create_session'
from /Users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/remote/bridge.rb:87:in `initialize'
from /Users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/common/driver.rb:52:in `new'
from /Users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/common/driver.rb:52:in `for'
from /Users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver.rb:84:in `for'
from test.rb:6:in `<main>'