Solution to problems with Python client and Appium service end-of-union

Source: Internet
Author: User
Tags appium

After installing the Mobile Automation test environment in accordance with the installation documentation, including: SDK, JDK, node. js, Appium, and client, Appium-doctor can successfully detect each companion version. Such as:

However, the run from Appium import webdriver error, escalation: Importerror:cannot Import name invalidargumentexception error.

I view the C:\Python27\Lib\site-packages\appium\webdriver\webdriver.py file and found that the file refers to the from selenium import Webdriver

So, I changed the code from Appium import Webdriver to the From selenium import webdriver, view Appium Service discovery to be successful.

However, when running the code, we found that the server reported the following error: Android devices must be of the API level or higher.

View my emulator and discover the version as:

And then decisively add a API17 version of the simulator,

Run the test script again:

#coding =utf-8
From Appium import Webdriver

Desired_caps = {}
desired_caps[' platformname ' = ' Android '
desired_caps[' platformversion '] = ' 4.4.2 '
desired_caps[' devicename '] = ' 192.168.54.101:5555 '
desired_caps[' apppackage '] = ' Com.android.calculator2 '
desired_caps[' appactivity '] = '. Calculator '

Driver = Webdriver. Remote (' Http://localhost:4723/wd/hub ', desired_caps)
Driver.find_element_by_name ("1"). Click ()
Driver.find_element_by_name ("5"). Click ()
Driver.find_element_by_name ("9"). Click ()
Driver.find_element_by_name ("9"). Click ()
Driver.find_element_by_name ("5"). Click ()
Driver.find_element_by_name ("+"). Click ()
Driver.find_element_by_name ("6"). Click ()
Driver.find_element_by_name ("="). Click ()
Driver.quit ()
Successfully connect to the server to start the analog phone's calculator function to do automated testing.

Solution to problems with Python client and Appium service end-of-union

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.