Using macaca for mobile hybrid automation testing (Part 3)

Using macaca for mobile hybrid automation testing (Part 3)

macaca provides a command to start the webdriver server separately. Then we use REPL as the client to send simulated operation commands to the server.

First start the server:

  1. macaca server --verbose  

After starting the server, first send a command to the server to let it wake up the simulator:

  1. >> var wd = require( 'webdriver-client' )({
  2. platformVersion: '9.3' ,
  3. deviceName: 'iPhone 5s' ,
  4. platformName: 'iOS' ,
  5. app: YOUR-APP-PATH
  6. });
  7.          
  8. >> var driver = wd.initPromiseChain();
  9.      
  10. >> driver.initDriver();
  11. //At this time, you can see that the server has started the IOS simulator.
  12.      
  13. //The next step is to write a script to operate the simulator.
  14. >> driver.waitForElementByXPath( '//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[2]/XCUIElementTypeButton[1]' ).click();
  15.      
  16. //See that native has completed an operation
  17.      
  18. >> driver.waitForElementByXPath( '//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeTextField[1]' ).sendKeys(123456789)
  19. //See that native has completed an input operation
  20.      
  21. //...Next, everyone can write their own test scripts according to their own process

↑The picture is the log of http communication between client and server.

The convenience of using REPL to write test cases is that the entire test process will not pause the entire server or simulator because of problems with the test cases you wrote. Therefore, you can write the test cases in REPL first, write the files after the results are correct, and then carry out the entire case test process after all the test cases are completed.

<<:  Using macaca for mobile hybrid automation testing (Part 2)

>>:  Using macaca for mobile hybrid automation testing (Part 4)

Recommend

Mom is still using plastic bottles to store seasonings? Throw them away!

The five flavors blend to create a hundred flavor...

Renault, Nissan and Mitsubishi to share electric vehicle technology

Recently, foreign media reported that Nissan Moto...

How to do marketing promotion on Zhihu?

The way Zhihu is presented to us is through artic...

The tricks behind flooding your Moments with national flags!

The national flag was all over the WeChat Moments...

Yu Lu丨The beauty of symmetry breaking realizes the unity of the physical world

Where is the beauty in broken symmetry? It actual...

Progress bar example ProgressDialog in Android

Progress bar is used to show the progress of a ta...

Baidu search CPC/eCPC/oCPC in one article

When promoting, many students often cannot distin...

The traffic is gone, can we rely on it to save the situation in 2017?

The opening rate and reading volume of WeChat pub...

Can eating sashimi with mustard kill insects? A must-read for seafood lovers!

Seafood is a favorite food for many people, and s...

Hey, are you ready to welcome the little cutie~ The baby koala is born!

I guess everyone already knows it~ Our little Liu...

Didi Friends Chain

SEO site introduction Souwai Didi Friendly Link P...