Appium1.6 locating iOS elements and manipulating elements

Source: Internet
Author: User
Tags appium

element Positioning methodthe first one: through Appium1.6 's inspector to seespecific installation methods before the essay has been introduced:http://www.cnblogs.com/meitian/p/7360017.html element XPath or name can be found by locating personally do not recommend this method, the actual operation found that after each operation click Refresh is slow, and sometimes the left layout file update is not timely, resulting in clicking on the left-hand screen control can not find the element, and sometimes the app source is not updated The second type: positioning elements via Macaca app Inspector1. Installing Macaca-li $ npm install macaca-cli -g 2. Check the Macaca environment $ macaca doctoras long as the printed results are green log information, it means that the environment is good 3. Installing App-inspector $ npm install app-inspector -g 4. How to useStart the detection Web interface with the following command, and then automatically open "/http/local ip:5678" in Safari to detect $ app-inspector -u YOUR-DEVICE-ID(设备id)  How iOS obtains the device ID: $ xcrun simctl listget the following data:The first parenthesis is the device ID of the phone, and the second parenthesis is the state of the emulator. as a result, you can also get the name and XPath of the element Description: I am currently using the second way, 1 is to directly refresh the page speed faster than Appium, 2 is not a great delay, after refreshing click on the element icon can generally find the element(also encountered a problem when the web opened, the phone interface at the bottom of the screen does not show the full, through the keyboard command and-number combination to reduce the page, showing the entire content) Note: App-inspector I use the simulator, with the real machine case has been an error. No problem with the simulator.error:connect econnrefused 127.0.0.1:8001At object.exports._errnoexception (util.js:1024:11)At Exports._exceptionwithhostport (util.js:1047:20)At Tcpconnectwrap.afterconnect [as OnComplete] (net.js:1150:14)  iOS action elementsThe XPath and name (or accessibility id) of the element can be obtained by the method above, and then the command corresponding to Appium is as follows:Accessibility ID or name: driver.find_element_by_name ( "name or accessibility id") driver.find_element (by.name, "NAME or Accessibility id")  XPath:Driver.find_element_by_xpath ( "XPath address")driver.find_element (By.xpath, "XPATH address")  

Appium1.6 locating iOS elements and manipulating elements

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.