美文网首页
[笔记]Selenium Testing Tools Cookb

[笔记]Selenium Testing Tools Cookb

作者: elf_fff | 来源:发表于2020-02-11 20:02 被阅读0次

Chapter 14 Testing Applications on Mobile Browsers

14.1 Setting up Appium for testing mobile applications

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 Cookb

      本文链接:https://www.haomeiwen.com/subject/ewcffhtx.html