Skip to content
Run selenium tests in multiple browsers with minimum hastle. Python flavor !
Pull request Compare This branch is 10 commits behind OniOni:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

python-parallel-wd -- Run selenium test in multiple browsers easily - Python flavor







Writing a test !

Start by importing the module

import wd.parallel

The test should be implemented as a unittest TestCase. So go ahead and do that

class Selenium2OnSauce(unittest.TestCase):

In the set up you should create your browsers configurations. Or you could just load them from a json file.

    def setUp(self):
        self.drivers = wd.parallel.Remote()

Now just write your test as you would for a unique browser. Test should be run on the self.driver attribute. Just use the @multiply decoration to run the test in all the browser you set up. Check out the selenium documentation for available methods.

    def test_sauce(self):
        self.assertTrue("I am a page title - Sauce Labs" in self.driver.title);
        self.driver.find_element_by_id('comments').send_keys('Hello! I am some example comments. I should appear in the page after you submit the form')

        comments = self.driver.find_element_by_id('your_comments')
        self.assertTrue('Your comments: Hello! I am some example comments. I should appear in the page after you submit the form' in comments.text)
        body = self.driver.find_element_by_xpath('//body')
        self.assertFalse('I am some other page content' in body.text)
        self.driver.find_elements_by_link_text('i am a link')[0].click()
        body = self.driver.find_element_by_xpath('//body')
        self.assertTrue('I am some other page content' in body.text)

The tear down method works just like the test cases. Just work as if there was one browser and add the @multiply decorator.

    def tearDown(self):

if __name__ == '__main__':

Supported Methods

Check out the python wd implementation it has all the documentation about actual tests.

More docs!

WD is simply implementing the Selenium JsonWireProtocol, for more details see the official docs:
Something went wrong with that request. Please try again.