how to run selenium tests on android and ios

14
Daniel Herken [email protected] http://www.browseemall.com Android & iOS Selenium 3

Upload: daniel-herken

Post on 09-Jan-2017

170 views

Category:

Software


0 download

TRANSCRIPT

Page 1: How to run Selenium tests on Android and iOS

Daniel [email protected]://www.browseemall.com

Android & iOS

Selenium 3

Page 2: How to run Selenium tests on Android and iOS

Today we will cover

1. What is Selenium?2. How to test on Android3. How to test on iOS4. Q/A Session

Introduction

Page 3: How to run Selenium tests on Android and iOS

Supported by all major browser vendors:

What is Selenium?

Free and open source browser automation framework.

Page 4: How to run Selenium tests on Android and iOS

What is Selenium?

How does it work?

Your Code

Page 5: How to run Selenium tests on Android and iOS

What is Selenium?

How does it work?

Your Code Selenium

Page 6: How to run Selenium tests on Android and iOS

What is Selenium?

How does it work?

Your Code Selenium

AndroidDriver

iOSDriver

Page 7: How to run Selenium tests on Android and iOS

Selenium language bindings are available for:

• Java• C#• Ruby• Python• JavaScript• Perl (third-party)• PHP (third-party)

What is Selenium?

Which programming languages are supported?

Page 8: How to run Selenium tests on Android and iOS

• Install Java: https://www.java.com/en/download/• Install Android Studio: https://developer.android.com/studio/index.html• Install SDK + Build tools with SDK Manager• Create an Emulator / Device• Download the driver: http://selendroid.io/• Start driver: java -jar selendroid-standalone-0.17.0-with-dependencies.jar

Setup Android

Requirements

Page 9: How to run Selenium tests on Android and iOS

A Simple Test

from selenium import webdriverfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.common.desired_capabilities import DesiredCapabilitiesimport time

driver = webdriver.Remote(desired_capabilities=DesiredCapabilities.ANDROID)driver.get("http://www.google.com")

elem = driver.find_element_by_name("q")

elem.send_keys("Selenium")

elem.submit()

time.sleep(5)

driver.quit()

Page 10: How to run Selenium tests on Android and iOS

Run on Android

Demo

Page 11: How to run Selenium tests on Android and iOS

• Install Xcode from the AppStore• Start Xcode at least once (otherwise it will fail to start the emulator)• Install Java• Download the driver: https://ios-driver.github.io/ios-driver/• Start driver: java -jar ios-server-standalone-0.6.6-SNAPSHOT.jar• Modify iPhone Emulator (Terminal)$xcodeVersion=`xcode-select --print-path`$sudo chmod a+rw "$xcodeVersion/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/Applications„$sudo chmod -R a+rw "$xcodeVersion/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/Applications/MobileSafari.app"

Setup iOS

Requirements

Page 12: How to run Selenium tests on Android and iOS

A Simple Test

from selenium import webdriverfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.common.desired_capabilities import DesiredCapabilitiesimport time

driver = webdriver.Remote(desired_capabilities=DesiredCapabilities.IPHONE)driver.get("http://www.google.com")

elem = driver.find_element_by_name("q")

elem.send_keys("Selenium")

elem.submit()

time.sleep(5)

driver.quit()

Page 13: How to run Selenium tests on Android and iOS

Run on iOS

Demo

Page 14: How to run Selenium tests on Android and iOS

Questions?

Q & A