Tool Options :
1. Appium --> only chrome browser
2. Selendroid --> only default browser
3. Chromedriiver with SDK --> only chrome browser
Limitations:
1, Supporting tools are not well developed
2, Device specific gesture are missing
3. Features are not equally supported on all versions
Future:
1. ChromeDriver will become strong contender, as chrome on android is getting more popular
2. Screencast and remote debugging by chromedriver
## Appium
#python-appium >> appium server should be running
from selenium import webdriver
capabilities = {
'device' : 'Android',
'platform' : 'WINDOWS',
'version' : '4.2.2',
'app': "Chrome"
}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', capabilities)
driver.get('http://google.com')
inputElement = driver.find_element_by_name("q")
inputElement.send_keys("cheese!")
inputElement.submit()
driver.save_screenshot("some.png")
driver.quit()
#ruby-appium>> appium server should be running
require 'selenium-webdriver'
capabilities = {
'device' => 'Android',
'platform' => 'WINDOWS',
'version' => '4.2.2',
'app' => "Chrome"
}
server_url = "http://127.0.0.1:4723/wd/hub"
driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)
driver.get("http://www.google.com")
element = driver.find_element :name => "q"
element.send_keys "Cheese!"
element.submit
driver.save_screenshot "some.png"
driver.quit()
## Selendroid
#python-selendroid >> selendroid server should be running
from selenium import webdriver
driver = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.ANDROID)
driver.get('http://google.com')
inputElement = driver.find_element_by_name("q")
inputElement.send_keys("cheese!")
inputElement.submit()
driver.save_screenshot("some.png")
driver.quit()
#ruby-selendroid >> selendroid server should be running
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :remote, :desired_capabilities => :android
driver.get("http://www.google.com")
element = driver.find_element :name => "q"
element.send_keys "Cheese!"
element.submit
driver.save_screenshot "some.png"
driver.quit()
## ChromeDriver
#python-chromedriver >> chromedriver server and adb server should be running
from selenium import webdriver
capabilities = {
'chromeOptions': {
'androidPackage': 'com.android.chrome',
}
}
driver = webdriver.Remote('http://localhost:9515', capabilities)
driver.get('http://google.com')
inputElement = driver.find_element_by_name("q")
inputElement.send_keys("cheese!")
inputElement.submit()
driver.save_screenshot("some.png")
driver.quit()
#ruby-chromedriver
require 'selenium-webdriver'
capabilities = {
'chromeOptions'=> {
'androidPackage' => 'com.android.chrome',
}
}
server_url = "http://127.0.0.1:9515/wd/hub"
driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)
driver.get("http://www.google.com")
element = driver.find_element :name => "q"
element.send_keys "Cheese!"
element.submit
driver.save_screenshot "some.png"
driver.quit()
No comments:
Post a Comment