-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppiumTest.py
More file actions
35 lines (26 loc) · 1.03 KB
/
AppiumTest.py
File metadata and controls
35 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import unittest
from appium import webdriver
from appium.options.android import UiAutomator2Options
from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
capabilities = dict(
platformName='Android',
automationName='uiautomator2',
deviceName='Android',
appPackage='com.android.settings',
appActivity='.Settings'
)
appium_server_url = 'http://localhost:4723'
class TestAppium(unittest.TestCase):
def setUp(self) -> None:
self.driver = webdriver.Remote(appium_server_url, options=UiAutomator2Options().load_capabilities(capabilities))
def tearDown(self) -> None:
if self.driver:
self.driver.quit()
def test_find_settings(self) -> None:
wait = WebDriverWait(self.driver, 10) # 최대 10초 대기
el = wait.until(EC.presence_of_element_located((AppiumBy.XPATH, '//*[@text="연결"]')))
el.click()
if __name__ == '__main__':
unittest.main()