Appium+iOS+Mac environment building

Select install desktop version directlyDownload Appium
Configure the main tool environment through the command line, only for iOS
# Get the Facebook Tap.
brew tap facebook/fb
# Install fbsimctl from master
brew install fbsimctl --HEAD
Copy the code
Link to the reference

Appium Getting Started The XCUITest Driver for iOS

Appium – doctor installation
npm install appium-doctor -g
Copy the code
Check whether iOS configurations are complete
appium-doctor --ios 
Copy the code
If prompted Xcode is not installed to execute
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
Copy the code
WebDriverAgentreplace
  • Perform. / Scripts/bootstrap. Sh
  • Open the webDriverAgent. xcodePro file directly with Xcode
  • Configure the certificates for WebDriverAgentLib and WebDriverAgentRunner
  • Connect and select your iOS device, then press Cmd+U, or hit Product->Test
  • On success, an Ip address and port number should be printed out in the Xcode console
  • Enter the url of the previous step in the browser. If some INFORMATION in JSON format is displayed, the operation is successful.
  • Replace the entire WebDriverAgent directory with the WebDriverAgent installed with Appium. Specific directory view for/Applications/Appium app/Contents/Resources/app/node_modules/Appium – xcuitest – driver/WebDriverAgent
Python supportAppium Python Client
Brew install python chmod 777 /Library/ python /2.7/site-packages/Copy the code
git clone [email protected]:appium/python-client.git 
cd python-client

python setup.py install
Copy the code
The test file

import unittest
import os
from appium import webdriver
from time  import sleep


class  appiumSimpleTezt (unittest.TestCase):

	def  setUp(self):
		app = os.path.abspath('Script-packed IPA directory')

		self.driver = webdriver.Remote(
			command_executor = 'http://127.0.0.1:4723/wd/hub',
			desired_capabilities = {
				'app':app,
				'platformName': 'iOS'.'platformVersion': '12.0'.'deviceName': 'iOS'.'bundleId': 'bundleId of the program'.'udid': 'UUID of real machine (obtained in Xcode Window->Devices)'
			}
			)

	def test_Login(self):
        
        # Permissions pop-up box
        self.driver.switch_to.alert.accept()
        self.driver.switch_to.alert.accept()
        sleep(1)
        Enter the user name and password to log in
        user_phone = self.driver.find_elements_by_name(name="Enter your mobile phone number")
        for phone in user_phone:
            phone.click()
            phone.send_keys("15219335287")
        user_password = self.driver.find_elements_by_name(name="Enter your password")
        for pw in user_password:
            pw.click()
            pw.send_keys("abc123456")
        sleep(1)
        # Hide keyboard
        keyboard_hide = self.driver.find_element_by_accessibility_id("Toolbar Done Button")
        keyboard_hide.click()
        # Click login
        login_button = self.driver.find_element_by_accessibility_id("Login")
        login_button.click()
        sleep(1)
    def tearDown(self):
        sleep(1)

		# self.driver.quit()

if __name__ == '__main__':
	suite = unittest.TestLoader().loadTestsFromTestCase(appiumSimpleTezt)
	unittest.TextTestRunner(verbosity=2).run(suite)

Copy the code
Test files in the project root directory, directly run the command.
python OFRiderTest.py
Copy the code

###### command line package ipA does not use pod directly run

xcodebuild -sdk iphoneos -target  [targetname]  -configuration Release
Copy the code

###### when using pod

xcodebuild -list
Copy the code
Xcodebuild-scheme [shemename] -workspace [xxx.xcworkspace absolute path] buildCopy the code

###### locates elements through Appium

{
  "bundleId": "bundleId"."automationName": "XCUITest"."platformName": "iOS"."platformVersion": "12.0"."udid": "uuid"."deviceName": "IPhone name"
}
Copy the code