Skip to content

Instantly share code, notes, and snippets.

@bbchriscesar
Created January 14, 2021 05:10
Show Gist options
  • Save bbchriscesar/5038d3e46f3046ce5b95646a7cfdd9ea to your computer and use it in GitHub Desktop.
Save bbchriscesar/5038d3e46f3046ce5b95646a7cfdd9ea to your computer and use it in GitHub Desktop.
import pytest
from appium import webdriver
import time
@pytest.mark.parametrize("udid, systemPort", [
("FA7BN1A04058", "8201"),
("FA7BN1A04086", "8202")
]
)
def test_SettingsTestCase(udid, systemPort):
capabilities = {
'platformName': 'Android',
'deviceName': 'Pixel 2',
'appPackage': 'com.android.settings',
'appActivity': '.Settings',
'udid': udid,
'systemPort': systemPort,
'automationName': 'UiAutomator2',
'noReset': True,
}
url = 'http://localhost:4723/wd/hub'
driver = webdriver.Remote(url, capabilities)
try:
for element in range(len(driver.find_elements_by_class_name("android.widget.RelativeLayout"))):
driver.find_elements_by_class_name("android.widget.RelativeLayout")[element].click()
time.sleep(1)
driver.back()
finally:
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment