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.
- Add the selenium-webdriver gem to your bundle install
- Create a helper module – lets called it BrowserHelper
- In that helper module require the selenium webdriver
- Create some classes / methods in your BrowserHelper module as required
- Call the methods from your calabash script – i.e. BrowserHelper::ClassName.method_name()
You are now interacting the with browser using Selenium Webdriver.