Launching Selenium Webdriver from within a Calabash automation script

Many people ask if it’s possible to launch a browser from within a Calabash automation script. Well, since the selenium-webdriver is just another gem the answer is of course yes, it is entirely possible.

Before I explain how to do this, you might first want to consider whether you really should do this. If you are trying to test a mobile app and a website in one automation suite – then this isn’t a good idea  – they should probably have separate automation suites. If you are trying to inject data through something like a CMS for your app then you should probably be using the API. However, if you really feel the need to do this then the solution is simple.

  1. Add the selenium-webdriver gem to your bundle install
  2. Create a helper module – lets called it BrowserHelper
  3. In that helper module require the selenium webdriver
  4. Create some classes / methods in your BrowserHelper module as required
  5. Call the methods from your calabash script – i.e. BrowserHelper::ClassName.method_name()

You are now interacting the with browser using Selenium Webdriver.

Advertisements

Please leave a comment - any questions or feedback welcome.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s