Configuring various browsers for Selenium web applications tests
Selenium can test your web applications quite easily (at least the frontend). To perform the tests it launches a webdriver which in most cases will be Firefox. But what about other browsers that may interpret CSS/JS differently, or what about mobile browsers on mobile devices? Selenium does support them, but to get them working some extra configuration is required. In this article I'll show how to make other browsers work with Python Selenium client (on Linux).We will start with an Selenium code that opens google.com and takes a screenshot of the page. By default if you have Firefox in the system it will (should) work out of the box:
To run Selenium on an Android device you will have to install Selenium server APK. To run it on an emulator from the SDK you will have to install it via adb.
Download android-server-*.apk and install it on the device (either download it on the device and run downloaded file or copy it to the device when connected to the computer).
For emulators managed by the Android SDK you will have to use platform-tools/adb to do the job. First list available devices/emulated systems:
This will allow Selenium to communicate with the server. For real devices connected to the same network you can try the device IP without port forwarding.Now for the Selenium client configuration. We will have to use remote webdriver - webdriver.Remote: chromedriver and set path to the extracted webdriver file.
There is a Opera webdriver, but I couldn't make it run on my Xubuntu box. The recipe is as follow. Download selenium-server-standalone-*.jar and set a path to this file under SELENIUM_SERVER_JAR variable in shell:
iOS is only supported on OSX (even if you want to use a real device). If you have it, check the ios webdriver page.
If you don't want to play with OSX or Xcode and Apple developers accounts you can try (payed) services that provide multiple browsers and systems for Selenium - like saucelabs.com or testingbot.com