background
Currently, the realization of iOS UI automation requires Xcode to start the WDA service. In some test cases, there will be two user interactions and result verification, then we need to connect two iPhone phones and start two WDAs to execute the corresponding automation scripts
But Xcode only supports starting a WDA service, what should I do?
solution
Start two WDA services through the command line
xcodebuild -project Downloads/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination “id=00008030-00021C192145802E” USE_PORT=8100 test
xcodebuild -project Downloads/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination “id=6724d831cfcd34a252299a2caa47b73f337a539b” USE_PORT=8110 test
PS: The content of the path, udid, and port of the WDA project that
needs to be connected to the corresponding iphone mobile phone
needs to be modified according to the actual situation
Appium configuration
If UI automation uses Appium, after successfully launching two WDAs on the command line, we also need to start two corresponding Appium services. We can create a copy of Appium through the principle of application replication in the mac system
After opening the two Appiums, set the WebDriverAgent Port and Server Port of the second Appium (the port number defined in the command line above) to distinguish them from the first Appium, and finally start the service.
In this way, we can start multiple WDAs