improved python sample codes (android + selendroid mode)

This commit is contained in:
drpy
2013-08-31 18:04:46 +02:00
parent d891acaeb9
commit 0cebb5ad52
2 changed files with 56 additions and 2 deletions
+9 -2
View File
@@ -9,14 +9,14 @@ PATH = lambda p: os.path.abspath(
desired_caps = {}
desired_caps['device'] = 'Android'
desired_caps['browserName'] = ''
desired_caps['version'] = '4.2'
desired_caps['version'] = '4.3'
desired_caps['app'] = PATH('../../../sample-code/apps/ApiDemos/bin/ApiDemos-debug.apk')
desired_caps['app-package'] = 'com.example.android.apis'
desired_caps['app-activity'] = '.ApiDemos'
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
el = driver.find_element_by_name("Animation")
el = driver.find_element_by_xpath('//text[contains(@value, "Animat")]')
assert el.text == "Animation"
el = driver.find_element_by_tag_name("text")
@@ -27,4 +27,11 @@ el.click()
els = driver.find_elements_by_tag_name("text")
assert els[2].text == "Activity"
driver.back()
el = driver.find_element_by_class_name("android.widget.ListView")
js_params = {"element": el.id, "text": "Views"}
driver.execute_script("mobile: scrollTo", js_params)
driver.quit()