Generally, cross browser tests are done manually on Browserstack; We can do the same using Selenium with Python bindings.
Selenium RC: JSON configuration
Sauce-specific settings are given inside Selenium's "browser" parameter. This is generally a string in the form "*browser" (e.g. "*iexplore", "*firefox"), but will now need to be a full JSON object like this:
{
"username": "your username here",
"access-key": "your access key here",
"os": "Linux",
"browser": "firefox",
"browser-version": "3"
}
Python Code:
#! /usr/bin/env python
#-.- coding=utf8 -.-
from selenium import selenium
import unittest, time, re
class login(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("saucelabs.com",
4444,
"""{
"username": "your-sauce-username",
"access-key": "your-access-key",
"os": "Linux",
"browser": "firefox",
"browser-version": "20"
}""",
"http://salesforce.com/")
self.selenium.start()
self.selenium.set_timeout(90000)
def test_empty_info(self):
sel = self.selenium
sel.open("/in/")
sel.click("id=button-login")
sel.wait_for_page_to_load("30000")
sel.type("id=username", "james")
sel.type("id=password", "connor")
sel.click("id=Login")
sel.wait_for_page_to_load("30000")
try: self.assertEqual("Your login attempt has failed. The username or password may be incorrect, or your location or login time may be restricted. Please contact the administrator at your company for help.", sel.get_text("css=div.loginError"))
except AssertionError, e: self.verificationErrors.append(str(e))
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
Note:- Reports are generated as log and video