Пример #1
0
 def test_is_wake_key(self):
     assert AndroidKey.is_wake_key(AndroidKey.MENU)
     assert not AndroidKey.is_wake_key(32)
Пример #2
0
 def test_is_system_key(self):
     assert AndroidKey.is_system_key(AndroidKey.HEADSETHOOK)
     assert not AndroidKey.is_system_key(21)
Пример #3
0
 def test_is_media_key(self):
     assert AndroidKey.is_media_key(AndroidKey.MEDIA_PAUSE)
     assert not AndroidKey.is_media_key(11)
Пример #4
0
 def test_is_confirm_key(self):
     assert AndroidKey.is_confirm_key(AndroidKey.SPACE)
     assert not AndroidKey.is_confirm_key(21)
Пример #5
0
 def test_is_gamepad_key(self):
     assert AndroidKey.is_gamepad_button(AndroidKey.BUTTON_8)
     assert not AndroidKey.is_gamepad_button(250)
Пример #6
0

desired_caps = dict()
desired_caps["platformName"] = "Android"
desired_caps["platformVersion"] = "5.1.1"
desired_caps["deviceName"] = "shamu"
desired_caps["appPackage"] = "com.android.settings"
desired_caps["appActivity"] = ".ChooseLockPattern"
desired_caps["unicodeKeyboard"] = True
desired_caps["resetKeyboard"] = True
desired_caps["noReset"] = True
desired_caps["newCommandTimeout"] = 6000
desired_caps["automationName"] = "UiAutomator2"


driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_capabilities=desired_caps)
sleep(3)
TouchAction(driver).press(x=90, y=300).move_to(x=270, y=300).move_to(x=450, y=300).move_to(x=450, y=480).perform()
# driver.get_screenshot_as_file(os.getcwd()+os.sep+'./screen.png')
print(driver.network_connection)
driver.set_network_connection(6)

driver.open_notifications()

AndroidKey.BACK()

input('任意按键退出')

driver.quit()