[笔记]Selenium Testing Tools Cookbook_Chapter14

Chapter 14 Testing Applications on Mobile Browsers

14.1 Setting up Appium for testing mobile applications

  • update homebrew
  • install Nodejs
  • install xcode
  • install carthage
  • install appium
  • config...
    reference: https://www.jianshu.com/p/612c2fa1dbe9

14.2 Testing mobile web applications on iOS using Appium

import unittest
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

class JianShu(unittest.TestCase):
    def setUp(self):
        # set the desired capabilities for iOS
        caps = DesiredCapabilities.FIREFOX.copy()
        caps['platformName'] = 'iOS'
        caps['platformVersion'] = '13.3'
        caps['deviceName'] = 'iPhone 7'
        caps['browserName'] = 'safari'
        #caps['bundleId'] = 'com.apple.mobilesafari'
        # Instantiate an instance of Remote WebDriver with the desired capabilities
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub',\
            caps)
        # open the page
        self.driver.get('https://www.jianshu.com')

    def testJianShu(self):
        Button = self.driver.find_element_by_xpath('//XCUIElementTypeStaticText[@name="一个优质创作社区"]')
        Button.click()

    def tearDown(self):
        self.driver.quit()

if __name__ == '__main__':
    unittest.main()

你可能感兴趣的:([笔记]Selenium Testing Tools Cookbook_Chapter14)