Book Image

Learning Selenium Testing Tools with Python

By : UNMESH GUNDECHA
Book Image

Learning Selenium Testing Tools with Python

By: UNMESH GUNDECHA

Overview of this book

Table of Contents (17 chapters)
Learning Selenium Testing Tools with Python
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using Sauce Labs


We looked at Sauce Labs for cross-browser testing in Chapter 6, Cross-browser Testing. Sauce also provides support for testing mobile applications using Appium. In fact, the Appium project is developed and supported by Sauce Labs. With minimal changes to the desired capabilities, we can run mobile tests in Sauce Labs with the following code:

import unittest
from appium import webdriver


class SearchProductsOnIPhone(unittest.TestCase):
    SAUCE_USERNAME = 'upgundecha'
    SUACE_KEY = 'c6e7132c-ae27-4217-b6fa-3cf7df0a7281'

    def setUp(self):

        desired_caps = {}
        desired_caps['browserName'] = "Safari"
        desired_caps['platformVersion'] = "7.1"
        desired_caps['platformName'] = "iOS"
        desired_caps['deviceName'] = "iPhone Simulator"

        sauce_string = self.SAUCE_USERNAME + ':' + self.SUACE_KEY

        self.driver = \
            webdriver.Remote('http://' + sauce_string + '@ondemand.saucelabs.com:80/wd/hub', desired_caps)
        self...