sfse hugs mobile 110318172148 phpapp01

Upload: keshab-fouzdar

Post on 03-Apr-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    1/39

    Selenium 2

    Jason HugginsCo-creator, The Selenium Project

    Co-founder, CTO, Sauce Labs Inc

    twitter: @hugs

    email: [email protected]

    mailto:[email protected]:[email protected]:[email protected]
  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    2/39

    Selenium 2:Why and What

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    3/39

    Mobile

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    4/39

    Types of Mobile Testing

    Emulator

    Real device (tethered to workstation)

    Real device in a real location on a real

    network

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    5/39

    Native vs Web

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    6/39

    Life before the Web

    Total Application Market

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    7/39

    Total Application Market

    JS+HTML

    Yesterday

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    8/39Total Application Market

    JS+HTML5

    Today

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    9/39

    Data?

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    10/39

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    11/39

    Sencha

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    12/39

    SproutCore

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    13/39

    PhoneGap

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    14/39

    Total Application Market

    JS+HTML5

    Today

    Seleniumlives here!

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    15/39

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    16/39

    Total Application Market

    JS+HTML5

    Today

    Seleniumlives here!

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    17/39

    Total Application Market

    JS+HTML5

    Tomorrow

    Seleniumlives here!

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    18/39

    Mobile - How?

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    19/39

    Checkout Selenium

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    20/39

    Android

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    21/39

    Download Android SDK

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    22/39

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    23/39

    Update

    $ cd ~/android_sdk/tools$ ./android update sdk

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    24/39

    Create AVD

    $ ./android create avd \-n my_android \-t 8 \

    -c 100M

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    25/39

    Start Emulator

    $ ./emulator -avd my_android \-no-audio \-no-boot-anim \

    -scale .8 &

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    26/39

    Install Selenium APK

    $ cd ~/android_sdk/platform-tools/$ ./adb -e install \

    -r ~/selenium/android/prebuilt/android-server.apk

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    27/39

    Port Forwarding

    $ ./adb forward tcp:8080 tcp:8080

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    28/39

    Launch App

    $ adb -s shell am start -n \org.openqa.selenium.android.app/org.openqa.selenium.android.app.MainActivity

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    29/39

    iPhone

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    30/39

    Open in XCode

    $ open ~/selenium/iphone/iWebDriver.xcodeproj/

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    31/39

    Build & Run

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    32/39

    iphonesim

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    33/39

    Demo!

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    34/39

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    35/39

    The Code:# The actual test scenario: Test the codepad.org code execution service.

    # Go to codepad.org

    driver.get('http://codepad.org')

    # Select the Python language option

    python_link = driver.find_elements_by_xpath("//input[@name='lang' and @value='Python']")

    [0]

    python_link.click()

    # Enter some text!

    text_area = driver.find_element_by_id('textarea')

    text_area.send_keys("print 'Hello,' + ' World!'")

    # Submit the form!

    submit_button = driver.find_element_by_name('submit')

    submit_button.click()

    # Make this an actual test. Isn't Python beautiful?

    assert"Hello, World!"in driver.get_page_source()

    # Close the browser!

    driver.quit()

    http://codepad.org/http://codepad.org/
  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    36/39

    Selenium 2 - The Moviehttp://www.youtube.com/watch?v=IUUcEIfkOEY

    http://www.youtube.com/watch?v=IUUcEIfkOEYhttp://www.youtube.com/watch?v=IUUcEIfkOEY
  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    37/39

    LinksFor More Information:

    http://seleniumhq.org

    http://code.google.com/p/selenium

    http://saucelabs.com/docs/selenium2

    http://twitter.com/hugs

    Demo Screencast:

    http://www.youtube.com/watch?v=IUUcEIfkOEY

    Code:

    http://gist.github.com/830011

    http://gist.github.com/830011http://gist.github.com/830011http://www.youtube.com/watch?v=IUUcEIfkOEYhttp://www.youtube.com/watch?v=IUUcEIfkOEYhttp://gist.github.com/830011http://gist.github.com/830011http://www.youtube.com/watch?v=IUUcEIfkOEYhttp://www.youtube.com/watch?v=IUUcEIfkOEYhttp://twitter.com/hugshttp://twitter.com/hugshttp://saucelabs.com/docs/selenium2http://saucelabs.com/docs/selenium2http://code.google.com/p/seleniumhttp://code.google.com/p/seleniumhttp://seleniumhq.org/http://seleniumhq.org/
  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    38/39

    One More Thing:

  • 7/29/2019 Sfse Hugs Mobile 110318172148 Phpapp01

    39/39

    Thanks!Jason Huggins

    Co-creator, The Selenium Project

    Co-founder, CTO, Sauce Labs Inc

    twitter: @hugs

    email: [email protected]

    mailto:[email protected]:[email protected]:[email protected]