In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
When we do iOS Appium automation testing, we will encounter problems of environment configuration and compatibility. Here is a summary to avoid stepping on these pits later.
Question 1. Prompt no module "appium"
Solution: step 1, enter the command at the terminal
Cd / usr/local/bin
Pip3 install Appium-Python-Client
Because appium is installed on python2 by default.
Step 2, check when you create a new project
Inherit global site-packages and Make available to all projects.
Question 2. Two ways to get udid
One way is to connect the iOS phone to iTunes to view the summary; the other is to open Xcode and select add simulator to view the udid.
Question 3. Prompt AssertionError: Message: An unknown server-side error occurred while processing the command.
Original error: Unknown device or simulator UDID:'* *'
Solution: brew install libimobiledevice-HEAD
If you prompt / usr/local/share/man/man5 / usr/local/share/man/man7 when executing this command, you need to modify the owner permissions, you need to follow the following command:
Sudo chown-R cy / usr/local/share/man/man5
Sudo chown-R cy / usr/local/share/man/man7
Question 4. Modify the environment variable to hang up the terminal
Solution: open the terminal, select Shell- > New command, enter mkdir disabled_shell_files, run the command; open a new terminal. Repeat the steps, then type mv .profile .bash _ history .bash _ profile .bashrc. Inputrc disabled_shell_files in the pop-up dialog box, and click run. Open a new terminal and you will see that the terminal is back to normal.
Problem 5. Unable to connect to github during brew update
Solution: modify etc/hosts and add the ip address of github at the end, such as 192.30.255.112
You can query the ip address at http://tool.chinaz.com/dns?type=1&host=github.com&ip=
Question 6. How to view the bundle id of app
Solution: step 1. Connect the real machine to the computer; step 2.Xcode-> Product- > Destination- > Add Additional Simulators. You can see all the app bundle id on the phone in the Devices menu bar.
Question 7. Installation appium-doctor reports an error
Npm install-g appium-doctor
Internal/modules/cjs/loader.js:611
Throw err
^
Error: Cannot find module 'semver'
At Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
At Function.Module._load (internal/modules/cjs/loader.js:535:25)
At Module.require (internal/modules/cjs/loader.js:663:17)
At require (internal/modules/cjs/helpers.js:20:18)
At Object. (/ usr/local/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
At Module._compile (internal/modules/cjs/loader.js:734:30)
At Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
At Module.load (internal/modules/cjs/loader.js:626:32)
At tryModuleLoad (internal/modules/cjs/loader.js:566:12)
At Function.Module._load (internal/modules/cjs/loader.js:558:3)
Resolve:
Brew uninstall node.js
Delete the node and node_modules files under / usr/local/lib
Then execute the following code
Sudo rm / usr/local/bin/npm
Sudo rm / usr/local/share/man/man1/node.1
Sudo rm / usr/local/lib/dtrace/node.d
Sudo rm-rf ~ / .npm
Sudo rm-rf ~ / .node-gyp
Sudo rm / opt/local/bin/node
Sudo rm / opt/local/include/node
Sudo rm-rf / opt/local/lib/node_modules
Question 8. When starting app,Pycharm, the runtime prompts that the HTMLtestrunner module cannot be found. You need to download the py file on the Internet and put it under the site-packages file of python.
Question 9. From appium Times error in Pycharm, prompt appium module not found
Solution: make sure the appium module, pip3 install appium-python-client, is installed, then Pycharm- > new project, and then in Pycharm- > preferences … In the project Interpreter option, click +, search for appium-python-client, and download package
At this time, enter from appium in pycharm and you can automatically match without error.
Question 10. Prompt Error running 'xxx': Cannot run program "/ Users/xx/PycharmProjects/xxx/venv/bin/python" (in directory "/ Users/xx/xxtest/xxx/test_case"): error=2, No such file or directory
Resolve:
1) only create project. On the prefrence for new project menu, find the Project Interpreter option, and it will indicate that the address is invalid in the address directory. Click the Add add button to relocate to the path of python.
2) after setting up, create project files, iostest-xxx-test_case and test_report, create py files under test_case, and then execute them without error.
Question 11. ModuleNotFoundError: No module named 'StringIO'
Solution: change import StringIO to from io import StringIO in HTMLTestRunner.py and change the writing of python2 to python3.
The problem 12.Appium was able to run yesterday, but cannot be started today
Solution: finally, it is found that the sever shown in the following figure is selected incorrectly, and the correct option should be the one selected below.
Question 13. Ios is different from android. When locating elements, the name method should be
Driver.find_element_by_accessibility_id ('')
Question 14. Run selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not create simulator with name 'appiumTest-iPad', device type id' iPad' and runtime id '12.1. Reason: 'simct...
Solution: you need to add the bundleid in the desired_caps on appium desk to the py file.
Question 15. Run Times error on Pycharm, prompting the path of python interpreter is not empty
Solution: in the window of the new new project, in addition to filling in the project name, don't forget to open the right corner of the second option, "Project Interpreter:New Virtualenv environment" to set the runtime compilation environment
If you set it up after creating the project-script, it will always report an error.
Question 16. HTMLTestRunner reported an error
HTMLTestRunner is an extension of the unittest module in the Python standard library. Use it to generate easy-to-use HTML test reports.
First download the HTMLTestRunner.py file, then execute the command python3 on the Mac terminal, and then enter the following command:
Import sys
Sys.path
Get the path shown in the following figure
Finally, copy the downloaded file to the path highlighted in step 2, and you can import HTMLTestRunner it in pycharm.
Because python2 and python3 are written differently, if the above still reports an error, you need to modify the HTMLTestRunner.py file.
Step 1, modify the HTMLTestRunner.py file as follows:
1) the module io replaces StringIO in python3
Line 94 import StringIO
Change to import io
2) everything related to StringIO should be changed.
Line 540 self.outputBuffer = StringIO.StringIO ()
Change to self.outputBuffer = io.StringIO ()
3) python3 does not have a has_key () method, so change the following code
If not rmap.has_key (cls)
Change to if not cls in rmap
4) decode and python2 of python3 are different, change
Line 769 uo = o.decode ('latin-1')
Change to uo = e
Line 779 ue = e.decode ('latin-1')
Change to ue = e
5) there is also a difference between the print () method of python3 and python2, change
Line 634 print > > sys.stderr,'\ nTime Elapsed=%s'% (self.stopTime-self.startTime)
Change to print (sys.stderr,'\ nTime Elapsed=%s'% (self.stopTime-self.startTime))
6) run the HTMLTestRunner.py file again and OK
Step 2, modify the suite.py file:
Because from is mentioned in the error report. Import case and from. Import util, comment out the code where these two lines are located, and run the suite.py file again to OK
Step 3, rerun the testcase.py file, and a concise test report in HTML form will be visible!
Add official Wechat: sy51testing reply keyword "Learning" to get limited software test learning materials.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.