Appium installation of the environment and the pit along the journey

Source: Internet
Author: User
Tags appium

Appium installation of the environment and the pit along the journey

installation of the first step environment

L JAVAJDK Installation and configuration of environment variables I'm not going to tell you this. Online tutorials are all, search for a install it

L ANDROIDSDK Installation is also the case I am the direct installation of studio, directly installed the SDK

L node. js installation Download, URL: http://nodejs.cn/download/

L Appium Download and installation

Website: https://bitbucket.org/appium/appium.app/downloads/

The second step verifies that the environment is installed successfully:

L

The third step: Environment installation encountered problems troubleshooting:

L EXECUTE command appium-doctor, hint: Android_home is not set

:

L Workaround: Configure Appium in the environment variable:

1) appium_home D:\ToolsInstall\Appium\node_modules\appium

2) path join: D:\ToolsInstall\Appium\node_modules\.bin

Fourth step: Run an instance of Appium

The code is as follows:

1 #Coding:utf-82 ImportOS3  fromSeleniumImportWebdriver4 5PATH =LambdaP:os.path.abspath (6Os.path.join (Os.path.dirname (__file__), p)7 )8Desired_caps = { }9desired_caps['devicename'] ='vbj4c18607003439'  #device name found by ADB devicesTendesired_caps['PlatformName'] ='Android' Onedesired_caps['platformversion'] ='8.1.0' #Android System version Adesired_caps['Apppackage'] ='Com.aerozhonghuan.serialporttool'  #package name of the app under test -desired_caps['appactivity'] ='com.aerozhonghuan.serialporttool.MainActivity'  #Activity at startup -Driver = Webdriver. Remote ('Http://localhost:4723/wd/hub', Desired_caps) theEl = driver.find_element_by_id ("com.aerozhonghuan.serialporttool:id/btn_heartbeat") - El.click () - Print('The first Appium script ran successfully') -Driver.quit ()
Fifth step: Positioning tools for elements in the script
    1. Get package name and start activity

Command: AAPT dump badging C:\Users\lenovo\Desktop\sany_serialport.apk

:

2. Get the page ID

SDK comes with tools: Android\sdk\tools\bin\uiautomatorviewer.bat

:

Sixth step: Problems encountered during running the script:
    1. Occurs during script run: A new session could not being created

A) The path to install the SDK first cannot contain spaces

b) Next environment variable configuration to use Android_home (I was sdk_home, after the change will no longer error)

c) The correct display of the modified page should be displayed as

:

2. Error while running the script:

"C:\Users\sxie\AppData\Local\Android\sdk\platform-tools\adb.exe-s emulator-5554 Shell" ps ' uiautomator ' ""

L CHANGE the \appium\node_modules\appium\node_modules\appium-adb\lib\adb.js 1033 lines to the following:

Code:

1ADB.prototype.getPIDsByName =function(name, CB) {2Logger.debug ("Getting All Processes with '" + Name + "'");3    This. Shell_grep ("PS", name,function(err, stdout) {4     if(err) {5Logger.debug ("No matching processes found");6       returncbNULL, []);7     }8     varPIDs = [];9_.each (Procs,function(proc) {Ten       varMatch =/[^\t]+[\t]+ ([0-9]+)/. EXEC (proc); One       if(match) { APids.push (parseint (match[1), 10)); -       } -     }); the     if(Pids.length!==procs.length) { -       varmsg = "Could not extract PIDs from PS output. PIDS: "+ -Json.stringify (PIDs) + ", procs:" +json.stringify (procs); -       returncbNewError (msg)); +     } -cbNULL, PIDs); +   }); A }; at  -ADB.prototype.shell_grep =function(CMD,GREP,CB) { -     if(Cmd.indexof ("") = = = 1){ -cmd = "" + cmd + ""; -     } -     varExecCmd = ' Shell ' + cmd + ' | grep ' +grep; in      This. EXEC (ExecCmd, CB); -};

Note: In the installation of the environment I refer to the ethanol blog and a brief book blog:

1) https://www.jianshu.com/p/3eddb5979c69?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes& Amp;utm_source=recommendation

2) http://www.cnblogs.com/nbkhic/p/3803883.html#undefined

Appium installation of the environment and the pit along the journey

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.