I am testing out BrowserStack and have a small suite of Selenium WebDriver tests written in Python. My goal is to run the tests in several different browsers. Currently I am using desired_capabilities to specify the browser, version, os, etc.
What would be a good way to repeat the test with a different browser without having a bunch of different py files?
Here's how the tests are setup:
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.desired_capabilities import DesiredCapabilities import unittest, time, re desired_cap = {'browser': 'Chrome', 'browser_version': '33.0', 'os': 'OS X', 'os_version': 'Mavericks', 'resolution': '1600x1200'} desired_cap['browserstack.debug'] = True class RegWD(unittest.TestCase): def setUp(self): self.driver = webdriver.Remote( command_executor='http://browserstackstuff.com', desired_capabilities=desired_cap) self.base_url = "http://blahtestsite.com/"