As you probably know, there are a lot of similarities between Selenium and Appium. As Appium is built to test all kinds of mobile apps (native, mobile web, and hybrid) it is surprisingly similar to Selenium which only works with mobile web.
Here are 4 quick steps you need to take to get your mobile website testing up and running using Appium, and naturally using real devices at Bitbar Testing.
Run Tests with Ready-Made Example
1. Download the Testdroid sample Appium TestScript for Chrome testdroid_chrome.py and navigate to the download directory via command line. (Make sure your machine is configured to run Python scripts.)
2. Open the TestScript testdroid_chrome.py in any text editor. Set the screenshotDir to the path where you want the screenshots to be saved in at your machine, and your credentials against testdroid_username and testdroid_password Desired Capabilities. You can use default values for now.
3. Run the test script -> $ python testdroid_chrome.py
4. The screenshots are available locally on your machine inside the directory you specified in Step 2. Continue by logging into https://cloud.bitbar.com and navigate to project name as defined in testdroid_project Desired Capability to get the following log files: A) Appium server log and B) Logcat/Instruments log.
Extend the Sample for Running Your Own Tests
Using the sample script as a base, you can easily extend the tests for your own website.
In the Testscript find the line like:
elem = driver.find_element_by_xpath('//*[@id="xxx"]')
This is the WebDriver command that tries to find an element on the web page. We are finding elements referring them with their XPath, but you are free to use other methods as you prefer (e.g. find_element_by_id, find_element_by_name).
In addition, more information about Appium use can be found here.
Learn all the basics about Appium, how to set it up and how to use it for mobile app testing.Download