Mobile WebAutomation using Selenium2.0


Published on

  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • 10/26/12 Confidential © 2008 Wipro Ltd
  • Confidential © 2008 Wipro Ltd 10/26/12
  • Mobile WebAutomation using Selenium2.0

    1. 1. Mobile Web Automation using Selenium2.0 By B.K.Venkata.UdayKumar
    2. 2. Contents :1. Theme of Presentation.2. What is Selenium 2.0 ?3. How Selenium 2.0 works for Mobile Web ?4. Other Tools and Framework5. Approach of using Selenium2.06. Test Environment Setup7. Advantages and Disadvantages8. Demo9. References
    3. 3. Theme oF PresentationThe main theme of this Presentation is Mobile Web functional testautomation with special stress on selenium suite of tools,frameworks, methodologies and approach.How would you automate functional tests and still run fromcommand line or from Emulator and Real Device?Sounds interesting right? This is our Selenium2.0+TestNG+Antframework
    4. 4. Selenium 2.0•Selenium, is an open Source tool from OpenQA.•The tool is considered to be one of the best tools available in the marketto automate the web applications testing.•Selenium offers quick and powerful way to write functional tests forapplications and an environment where they can be run across differenthosts.•One of Selenium’s key features is the support for executing one’s tests onmultiple browser platforms.
    5. 5. Selenium 2.0 Vs Selenium 1.0Selenium 2.0 Selenium 1.0Selenium 2 is the future direction of the project and the Selenium RC was the main Selenium project for a longnewest addition to the Selenium toolkit. time.Mobile Application Testing is Supported. Mobile Application Testing is not supported.It supports the Web Driver API and underlying Selenium 1 is still actively supported and provides sometechnology, along with the Selenium technology features that may not be available in Selenium 2 for a while, including support for several languages and support for almost every browser out there.Selenium web driver makes direct calls to the browser It works with Java Script and requires Seleium server tousing each browser native support for automation. inject the script into the browser and to then translate message from your test programs language specific selenium client library into commands that invoke the java script commands which in turn automate the AUT from within the browser
    6. 6. How Selenium 2.0 Works for Mobile Web(Android Devices) ?1. The Android Driver uses the RemoteWebDriver.2. The client side is your test code(Java Code).3. The server side is an application that gets installed on the android emulator or device.(android-server.apk)4. The client and the server communicate using the Wire Protocol which consists of REST requests using JSON over HTTP.5. The application executes the tests in the context of an Android Web View.
    7. 7. How Selenium 2.0 Works for Mobile Web Web(Android Devices) ?Step 1:Install Android SDKStep 2:Set up the Emulator or Android Device.Step 3:Install the Android WebDriver Application using the command adb -s <serialId> -e install -r android-server.apkStep 4: Setup Port Forwarding using the command adb -s <serialId> forward tcp:8080 tcp:8080Step 5:Start the Web Driver server on the Emulator or Android device.Step 6:Run the Test Script.
    8. 8. Other Tools and FrameworkTools and Purpose and FunctionUtilitiesTest NG 1. TestNG is a framework that makes data-driven testing possible in selenium. 2. This framework is used to organize different tests, and to report results. 3. TestNG is a testing framework created in line with Junit but with added features that makes it suitable for use in regression test automation projects. 4. Data Provider is one such feature in testing; it allows a test method to be executed with multiple sets of data.ANT 1. Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. 2. The main known usage of Ant is the build of Java applications. 3. Ant provides the glue to hold everything together, and execute basic commands.
    9. 9. An Approach of Using Selenium2.0 Integration of Selenium2.0 with TestNG and ANT. This framework is created using ANT, TestNG and Selenium 2.0. Through this framework, an user will be able to create an automated test case that can be executed in a single command. Parameters Appending Selenium2.0+ values TestNG Script Mobile Web Returns Result Report Results to a File Temp Folder Report_Template.xls Reports.xls(*)+TestNG Report ANT
    10. 10. Test Environment Setup
    11. 11. Test Environment Setup(Software and Hard Ware) Server/Computer Mobile Device  Java SDK1.5 and above  Android Device  If using python, then Python 2.7  Inbuit Mobile Broswer or any  Eclipse IDE supported browser  Ant or Maven for build integration  android-server-2.16.apk  ( ( ownloads/detail?name=android- ownloads/list) server-2.16.apk&can=2&q=)  Test  Accessibility to Internet. Ng( ml) for reporting if using java  Internet connection
    12. 12. Advantages and Disadvantages Advantages : Runs in Android browser Uses native touch events to emulate user interaction Runs on emulator and device Supports multiple languages(Java,Python,c#,perl) Disadvantages :• The driver is unlikely to work reliably on these versions. There were several limitations, for instance XPath wasnt supported natively and the Android Driver used to inject an Xpath library in WebView.
    13. 13. DEMO The Mobile Web Site used is: of Script:Using java:Using python:Prerequisite: For Java For Python Java SDK 1.5 and above Python 2.7 and above  android-server.apk Python bindings(use easy_install selenium ) Selenium2.0
    14. 14. Script: using Javaimport org.openqa.selenium.By;import org.openqa.selenium.WebElement;import;public class OneTest extends TestCase {  public void testScript() throws Exception {    WebDriver objDriver = new AndroidDriver();      // visit site    objDriver.get("");         // Check the title of the page    System.out.println("Page title is: " + objDriver.getTitle());    objDriver.quit();}}
    15. 15. Script: using pythonfrom selenium import webdriverobjDriver = webdriver.Remote(browser_name="android", command_executor=“”)objDriver.close()
    16. 16. References:  
    17. 17. Thank You