ruby - calabash-automate the app which gets opened by hitting a link from browser -


i have calabash android set there working fine. have add scenario in android emulator need open default browser navigate url ( i.e https://def/l/abc) open app assuming app installed. can login app , move on. how can automate through calabash . particularly open browser , click link . assume emulator opened. found like

 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!  

however giving error

 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)     /users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:878:in `open'    /users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'    /users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/timeout.rb:66:in `timeout'     /users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:877:in `connect'     /users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:862:in `do_start'     /users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:851:in `start'     /users/asinha/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/net/http.rb:1367:in `request'     /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'     /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'     /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'     /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'     /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'     /users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/remote/bridge.rb:87:in `initialize'     /users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/common/driver.rb:52:in `new'     /users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver/common/driver.rb:52:in `for'    /users/asinha/.rvm/gems/ruby-2.0.0-p598/gems/selenium-webdriver-2.46.2/lib/selenium/webdriver.rb:84:in `for' test.rb:6:in `<main>' 

i think may confusing calabash used for. calabash used testing ios , android apps. best of knowledge, calabash not support you're attempting do. if i'm wrong in assuming calabash cannot open app via url, still need add <uses-permission android:name="android.permission.inject_events"/> android manifest file in order able use "native" functionality of phone, such pressing home button, pressing button, etc. you're going face problem of not being able launch web browser. calabash uses apk file install app on phone replace using simulator. calabash therefore in of "sandbox" environment because not know how communicate device's firmware , hardware. therefore, best of knowledge, you're trying not in scope of calabash achieves. hope helps.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -