-
Notifications
You must be signed in to change notification settings - Fork 2
/
Tests.py
61 lines (49 loc) · 2.32 KB
/
Tests.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import unittest
from time import sleep
from appium import webdriver
from appium.webdriver.common.appiumby import AppiumBy
class SampleTest(unittest.TestCase):
@classmethod
def setUp(self):
desired_caps = {}
desired_caps['app'] = "root"
desired_caps['platformName'] = "Windows"
self.desktopSession = webdriver.Remote(
command_executor="http://127.0.0.1:4725/wd/hub",
desired_capabilities=desired_caps)
rs_window = self.desktopSession.find_element(AppiumBy.NAME("RobotStudio"))
rs_windowHandle = rs_window.get_attribute("NativeWindowHandle")
topLevelWindow = format(int(rs_windowHandle), 'x')
desired_caps = {}
desired_caps["appTopLevelWindow"] = topLevelWindow
desired_caps['platformName'] = "Windows"
self.desktopSession1 = webdriver.Remote(
command_executor="http://127.0.0.1:4725/wd/hub",
desired_capabilities=desired_caps
)
self.desktopSession1.find_element(AppiumBy.NAME("CmdBarCtl_VirtualFlexPendant")).click()
desired_caps = {}
desired_caps['app'] = "root"
desired_caps['platformName'] = "Windows"
self.desktopSession2 = webdriver.Remote(
command_executor="http://127.0.0.1:4725/wd/hub",
desired_capabilities=desired_caps)
vp_window = self.desktopSession2.find_element(AppiumBy.NAME("Virtual FlexPendant"))
vp_windowHandle = vp_window.get_attribute("NativeWindowHandle")
vp_topLevelWindow = format(int(vp_windowHandle), 'x')
desired_caps = {}
desired_caps["appTopLevelWindow"] = vp_topLevelWindow
desired_caps['platformName'] = "Windows"
self.desktopSession3 = webdriver.Remote(
command_executor="http://127.0.0.1:4725/wd/hub",
desired_capabilities=desired_caps)
self.desktopSession3.find_element(AppiumBy.ACCESSIBILITY_ID("ABBbutton")).click()
self.desktopSession3.update_settings({"imageMatchThreshold": 0.9})
self.desktopSession3.find_element(AppiumBy.IMAGE("C:\Images\Systeminfo.jpeg")).click()
sleep(2)
@classmethod
def Teardown(self):
self.desktopSession.quit()
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(SampleTest)
unittest.TextTestRunner(verbosity=2).run(suite)