使用提官方使用提供的demo,想在python使用appuim调用windows的app进行自动,
后台winappdriver已经启动
class SimpleCalculatorTests(unittest.TestCase):
@classmethod
def setUpClass(self):
#set up appium
desired_caps = {}
desired_caps["app"] = "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App"
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723',
desired_capabilities= desired_caps)
def test_addition(self):
self.driver.find_element_by_accessibility_id("num1Button").click()
self.driver.find_element_by_accessibility_id("plusButton").click()
self.driver.find_element_by_accessibility_id("num7Button").click()
self.driver.find_element_by_accessibility_id("equalButton").click()
self.assertEqual(self.getresults(), "显示为 8")
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(SimpleCalculatorTests)
unittest.TextTestRunner(verbosity=2).run(suite)