Configuring User Agents with Capybara + Selenium Webdriver

Posted . Visible to the public.

A while ago we were working on an application that had an entire version specially created for mobiles, such as the iPhone. This specific application was entirely tested with Capybara, Steak and Selenium Webdriver. Although the test suite wasn’t the fastest one in the world, the web application was very well tested, and to guarantee that we would also be testing the mobile version, we would have to simulate an iPhone user agent accessing the application.

But wait, you might be thinking that we are not able to change browser headers while dealing with Selenium. Capybara has a nice API to define new drivers and Selenium allows us to define different profiles with custom configurations for each driver.

Last edit
Keywords
capybara, selenium, testing, makandra
License
Source code in this card is licensed under the MIT License.
Posted by Lexy to makandra dev (2011-03-01 22:30)