Appium的一些问题的总结答案

 
 
问题
1. error: Failed to start an Appium session, err was: Error: Requested a new session but one was in progress
 
之前的会话没有关闭,然后你又运行了测试实例,也没有设置覆盖
解决
1. 重新停止appium服务,开启Appium服务 
2. Genarel Setting那里设置覆盖Session,重启Appium
测试结束在AfterClassdriver.quit()
 
 
-------------------------------------------------------------------------------------
2. error: Failed to start an Appium session, err was: Error: Command failed: C:\Windows\system32\cmd.exe /s /c "D:\android-sdk-windows\platform-tools\adb.exe -s adb server version (32) doesn't match this client (36); killing…
wait-for-device" 
error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037:
没有链接上手机或者模拟器,请确认已经连接成功,重新链接
 
-------------------------------------------------------------------------
3. error: Android devices must be of API level 17 or higher. Please change your device to Selendroid or upgrade Android on your device.
手机系统低于4.2appium不支持4.2.2以下的系统,请换一个手机或者模拟器来测试。
 
------------------------------------------------------------------------------------
4. Error: Permission to start activity denied.
 
**activity在清单文件里面没添加Android:exported="true"的话,你不能直接打开对应的activity,需要从启动页activity打开。 
exported属性就是设置是否允许activity被其它程序调用**
 
--------------------------------------------------------------------------------------------------------------------
5. error: Failed to start an Appium session, err was: Error: Activity used to start app doesn't exist or cannot ve launched! Make usre it exists and is launchable activity
要打开的activity不存在,activity路径错误,改为完整正确的activity路径
 
----------------------------------------------------------------------------------
6. error: Failed to start an Appium session, err was: Error: 'java - version' failed. Error: Command failed: C:\Windows\system32\cmd.exe /s /c "java -version"
 
Java版本错误,请安装最新的版本
 
-----------------------------------------------------------------------------------
7.> info: [debug] Error: Command failed: C:\Windows\system32\cmd.exe /s /c "D:\android-sdk-windows\platform-tools\adb.exe -s 8806a0b0 shell "echo 'ready'"error: unknown host service
链接手机失败,重新链接手机即可,我就是重新拔插了一下usb
Error: Command failed: C:\Windows\system32\cmd.exe /s /c "D:\android-sdk-windows\platform-tools\adb.exe -s 8806a0b0 shell "echo 'ping'""
error: unknown host service
adb被突然占用导致,例如你在运行用例的时候运行了模拟器。
 
-----------------------------------------------------------------------------------------------------------------
8. UIAutomatorViewer提示: Unable to connect to adb. Check if adb is installed correctly
解决,sdk升级到了25产生的问题。
解决方法:
  1. adb.exe 复制一份到uiautomatorviewer.bat 目录下
  2. 修改uiautomatorviewer.bat文件最后一行(改binddir=%prog_dir%为自己的platform-tools本地路径) 
9 error: Failed to start an Appium session, err was:INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling
When you are at final step to execute test automation script for mobile app testing on a mobile emulator or a virtual device or a real device, you might observe that script execution fails with different kinds of errors, In context to current article you will look at the error and solutions for: INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.
Error in Appium Server:
1
2
3
4
5
6
7
8
Error: Command failed: C:\Windows\system32\cmd.exe /s /c
"C:\Users\{User}\AppData\Local\Android\sdk\platform-tools\adb.exe -s
emulator-5554 install
"C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk""
   
> Failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\
settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install
io.appium.settings without first uninstalling.]
Error in Android studio run console:
1
2
3
4
5
6
7
8
9
org.openqa.selenium.SessionNotCreatedException: A new session could not be created.
(Original error: Command failed: C:\Windows\system32\cmd.exe /s /c
"C:\Users\{User}\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 install
"C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk""
Failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\
settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install
io.appium.settings without first uninstalling.]
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
For the first time when you execute the script it might pass, but it will fail with above error when you try to execute the same or any other script multiple times. Or when your test script execution fails on the first attempt for some other reason, and when you fix it and execute it again, you might encounter this new issue.
 
原因:
The reason for this error is that Appium installs 2 mobile applications before executing the script.
1. io.appium.settings
2. io.appium.unlock
These are the supportive mobile applications appium utilizes to execute the test automation script in Mobile Emulator or virtual device or a real mobile device.
Ideally Appium should remove these files every time at the end of the script execution or termination, if it is intends to install them every time a script is executed, or it should conditionally install these apps / apks to the mobile emulator or mobile device.
In your mobile emulator / Virtual Device / Real device, the 2 mobile applications appear as below:
 
There are multiple ways to troubleshoot this error and go ahead for a successful test script execution.
 
解决办法
Solution 1: ADB's uninstall command to remove the files.
You can open command prompt, assuming that you already had set the environment variables for ANDROID_HOME and Path variables for sdk tools and platform tools.
And execute commands as shown below:
 
 
 
Solution 2: Uninstall manually
You can open the mobile emulator / virtual device / real device and go to apps and uninstall them.
Solution 3: Write code as part of your test automation script.
As part of your selenium test automation script, you could write instructions to execute the commands provided in solution 1 above, so that this issue would not arise.
Hope this article has been helpful and you are able to proceed further with script execution.
Request to kindly share any of your queries in form of comments, we would try our best to provide any solution for you.
------------------------------------------------------------------------------------------------------------ 
10. 出错信息里含有"ps 'uiautomator',具体信息未 A new session could not be created. (Original error: Command failed: C:\Windows\system32\cmd.exe /s /c "C:\Users\sxie\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "ps 'uiautomator'""
android-appium: A new session could not be created
detail log:
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Command failed: C:\Windows\system32\cmd.exe /s /c "C:\Users\sxie\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "ps 'uiautomator'""
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'WL00070299', ip: '10.110.12.39', os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_40'
Driver info: driver.version: AndroidDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at io.appium.java_client.remote.AppiumProtocolHandShake.createSession(AppiumProtocolHandShake.java:161)
at io.appium.java_client.remote.AppiumProtocolHandShake.createSession(AppiumProtocolHandShake.java:76)
at io.appium.java_client.remote.AppiumCommandExecutor.doExecute(AppiumCommandExecutor.java:111)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:162)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:236)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:137)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:112)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:73)
at com.sky.demo.ContactTest.setUp(ContactTest.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
==========================================
直接在cmd中执行"C:\Windows\system32\cmd.exe /s /c "C:\Users\sxie\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "ps 'uiautomator'""
bad pid 'uiautomator'", 报错: bad pid 'uiautomator'
代码内容为
 
public class ContactTest {
private AndroidDriver driver; 
@Before
public void setUp() throws Exception {
//设置apk的路径
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "apps");
File app = new File(appDir, "ContactManager.apk");
  1. //设置自动化相关参数
  1. DesiredCapabilities capabilities = new DesiredCapabilities();
  1. capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
  1. capabilities.setCapability("automationName","Appium");
  1. capabilities.setCapability("platformName", "Android");
  1. capabilities.setCapability("deviceName", "Pixel_XL_API_25");// Galaxy_Nexus_API_25
 
  1. capabilities.setCapability("noReset", true);
  1. capabilities.setCapability("avdReadyTimeout", 300000);
  1. capabilities.setCapability("sessionOverride", true);
 
  1. //设置安卓系统版本
  1. capabilities.setCapability("platformVersion", "7.1.1");
  1. //设置apk路径
  1. capabilities.setCapability("app", app.getAbsolutePath());
 
  1. //设置app的主包名和主类名
  1. capabilities.setCapability("appPackage", "com.example.android.contactmanager");
  1. capabilities.setCapability("appActivity", ".ContactManager");
 
  1. //初始化
  1. driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
  1. driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
  1. }
 
  1. @Test
  1. public void addContact(){
  1. WebElement el = driver.findElement(By.name("Add Contact"));
  1. el.click();
  1. List<WebElement> textFieldsList = driver.findElementsByClassName("android.widget.EditText");
  1. textFieldsList.get(0).sendKeys("feimaoyuzhubaobao");
  1. textFieldsList.get(2).sendKeys("forever together");
  1. driver.swipe(100, 500, 100, 100, 2);
  1. driver.findElementByName("Save").click();
  1. }
 
  1. @After
  1. public void tearDown() throws Exception {
  1. driver.quit();
  1. }
}
 
 
解决办法:
resolved by this way:
adb.js(C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js) 中1035 行this.shell("ps '" + name + "'", function (err, stdout) {
对应执行的指令是ps 'uiautomator', Android7不支持这个指令格式,所以执行结果是bad pid 'uiautomator'
目前Appium未对此进行处理,所以需要修改此指令的执行方式
即将
this.shell("ps '" + name + "'", function (err, stdout) {
if (err) return cb(err);
替换成
this.shell_grep("ps", name, function (err, stdout) {
if (err) {
logger.debug("No matching processes found");
return cb(null, []);
}
并增加上面用到的shell_grep函数:
ADB.prototype.shell_grep = function (cmd, grep, cb) {
if (cmd.indexOf('"') === -1) {
cmd = '"' + cmd + '"';
}
var execCmd = 'shell ' + cmd + '| grep ' + grep;
this.exec(execCmd, cb);
};
 
---------------------------------------------------------------------------------------------------------------------
11.Android 7.0系统的手机无法执行appium脚本的问题
Appium Appium 版本 1.4.16,Android 设备固件 7.x,执行脚本时,报错使用语言:python报错如下:
WebDriverException: Message: A new session could not be created. (Original error: Could not extract PIDs from ps output. PIDS: [], Procs: ["bad pid 'uiautomator'"])
这个是因为appium版本1.4.16 使用的 uiatumator1.0不支持的原因导致?如果不升级appium版本,是否有解决方案?
解决办法
uiautomator1.0应该是不支持7.0,不升版本就换用uiautomator2.0吧,或者用下面的改脚本的方法使用。
解决Android 7.0系统的手机无法执行appium脚本的问题,改问题的具体解决方法如下:
  1. 找到appium的安装目录下的adb.js文件,windows版本的目录如下:Appium\node_modules\appium\node_modules\appium-adb\lib
2 打开adb.js,手动修改该文件下的内容,此方法我已经试验成功。
adb.js 中1035 行this.shell("ps '" + name + "'", function (err, stdout) {
对应执行的指令是ps 'uiautomator', Android7不支持这个指令格式,所以执行结果是bad pid 'uiautomator'
目前Appium未对此进行处理,所以需要修改此指令的执行方式
即将
this.shell("ps '" + name + "'", function (err, stdout) {
if (err) return cb(err);
替换成
this.shell_grep("ps", name, function (err, stdout) {
 
if (err) {
logger.debug("No matching processes found");
return cb(null, []);
}
并增加上面用到的shell_grep函数:
ADB.prototype.shell_grep = function (cmd, grep, cb) {
if (cmd.indexOf('"') === -1) {
cmd = '"' + cmd + '"';
}
var execCmd = 'shell ' + cmd + '| grep ' + grep;
this.exec(execCmd, cb);
};
 
 
 
  1. 网上还有如下的修改解决办法:以下我未试验。
ADB.prototype.getPIDsByName = function (name, cb) {
logger.debug("Getting all processes with '" + name + "'");
this.shell("ps '" + name + "'", function (err, stdout) {
if (err) return cb(err);
stdout = stdout.trim();
var procs = [];
var outlines = stdout.split("\n");
outlines.shift(); //在该处添加此行代码
3、重启appium
 
-------------------------------------------------------------------------------------------------------------------------------------
 
12、:WARN AppiumDoctor ✖ Bin directory for $JAVA_HOME is not set.
这个问题困扰了我两天,搜索各个网站无果,求助各个所谓的测试交流群(原来大家都是在里面胡聊)无人帮助回答,无奈FQ至国外搜寻答案解决问题:
解决办法:You can try setting the .bash_profile as well and you can try to set JAVA_HOME variable like this :
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${JAVA_HOME}/bin:$PATH
重启电脑即可。
if not,please try:
export PATH=$PATH:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin
To verify that all of Appium's dependencies are met you can use appium-doctor
翻译:为了验证Appium的所有依赖项是否满足,您可以使用Appium - doctor
 
13Message: Parameters were incorrect. We wanted {"required":["value"]} and you sent ["text","sessionId","id","value"]
在执行脚本的时候会报这样一个错误,这个问题是因为selenium版本过高,和1.6.5的Appium不兼容。需要把selenium版本降到3.3.1或者2.53.1就行了。
查看selenium版本方法:在终端进入到Python的命令行状态
>>>import selenium
>>>help(selenium)
输入以上两行命令就可查看当前selenium版本。
更换selenium版本方法:
pip3 uninstall selenium
pip3 install selenium==3.3.1 #注意,==两边没有空格
解释:这里使用pip3而不是pip,是因为我的电脑Xcode里有一个自带的2.7版本,而我又安装了一个3.6版本的。pip3是指卸载了我安装的Python3.6版本的Selenium,而我每次都会使用Python3.6,而不是系统自带的Python2.7.如果使用pip,则改变的是系统自带的selenium。
 
14:HTMLTestRunner.py文件本身报的几个错误
在使用Appium的时候往往我们需要生成直观的测试报告,这时候就需要使用到HTMLTestRunner.py文件(这是官网)。但是这个文件5年前就已经不更新了,那时候用的还是Python2,现在大多已经使用了Python3了,所以就导致了一些问题的产生。目前报错是5处,我们需要对官网提供的这个HTMLTestRunner.py文件做5处修改。网上也可以查到需要修改的地方,但是都不是很准确,这里我提供一个修改之后的,修改之处我都做了注释,可以看到修改前和修改后的区别。
 
这个问题我是在使用HTMLTestRunner的时候产生的,原因就是打开文件的方式错误造成的,造成的后果就是生成的测试报告是空的。在打开文件的时候开始的时候(就是没用HTMLTestRunner的时候,记住,是在自己写的执行脚本里,不是在HTMLTestRunner.py文件里)使用的是:open('HTMLReport.html', 'w') as f: 。这时候需要改成:open('HTMLReport.html', 'wb') as f:就可以了。(我也不太清楚原因是什么,网上有说文件打开的方式默认是二进制)
在这里我对Python的open函数做一个解释,如果有不对的地方欢迎指正,在此感谢.
open(路径+文件名,读写模式) #路径名为可选,默认是当前路径
解释读写模式:r(read)只读,r+读写,w(write)新建(会覆盖原有文件),a(append)追加,b(binary)二进制文件
常用模式如:'rb','wb','r+b'等等
读写模式的类型有: rU或Ua 以读方式打开,同时提供通用换行符支持(PEP 278) w 以写方式打开 a 以追加模式打开(从EOF开始,必要时创建新文件) r+ 以读写模式打开 w+ 以读写模式打开(与a+的区别是该种方式会清空原有内容) a+ 以读写模式打开(参见a) ab 以二进制追加模式打开(参见a) rb+ 以二进制读写模式打开(参见r+) wb+ 以二进制读写模式打开(参见w+) ab+ 以二进制读写模式打开(参见a+)
 
16:Could not connect to lockdownd. Exiting.
解决办法一,提高权限:
sudo chmod -R 777 /usr/local/lockdown/
解决办法二,比较麻烦但是解决较彻底:
brew uninstall ideviceinstaller brew uninstall libimobiledevice brew install --HEAD libimobiledevice brew link --overwrite libimobiledevice brew install ideviceinstaller brew link --overwrite ideviceinstaller
 
17、 如何验证Appium环境已经配置成功
首先需要安装appium-doctor,然后再用appium-doctor验证
npm install -g appium-doctor appium-doctor
 
18、Could not link: /usr/local/share/doc/homebrew
Please delete these paths and run brew update.
这个问题其实严格来说并不是Appium的问题,只是在解决Appium问题的时候会用到Homebrew,在更新brew(brew update)的时候报了这样一个错,原因就是:
Because you have files there already that we don't overwrite automatically in case they are important.
解决办法就是把这个路径delete,然后再update,方法如下:
rm -rf /usr/local/share/doc/homebrew
这是一个非常可怕的命令行,真的很恐怖,简直就是数据终结者,我之所以会写这篇文章就是错误的使用了rm -rf,导致电脑上的数据全部被清空,那种感觉是绝望的,不得已重新配置Appium环境。
 
19、Carthage was NOT found!
这个问题是在你检验Appium配置是否成功的时候出现,解决这个问题比较简单,安装这个Carthage就好了,方法:
brew update brew install carthage
 
20、code65的错误
 
这个错误很常见,出现在用真机的时候,原因就是真机上没有安装WDA,只要把WDA装到真机上就可以解决报错。
 
21、未安装ios-deploy的错误
 
 
解决这个问题很简单,就按照截图中的报错提示:利用npm安装ios-deploy就好了。
npm install -g ios-deploy
 
22、permission to start activity denied appium
 
这是在Android真机时发生的错误,别再到处找解决方案了,赶快找Android开发人员吧。让他在项目里改一个属性重新给你打一个包,就是这属性限制了我们的测试:
exported = true这个属性默认是false。
 
23、ImportError: No module named appium
在运行脚本的时候报这样一个错误,原因是没有安装Appium Python Client,把这个安装上就好了:
pip3 install Appium-Python-Client
如果这条命令报错,请换:
pip3 install --user Appium-Python-Client
如果还报错,就只有最后这个大法了,加sudo,sudo虽好,能不用则不用:
sudo pip3 install --user Appium-Python-Client
 
24、AttributeError: module 'appium.webdriver' has no attribute 'remote'
用了一段时间,同样的步骤,竟然会有这样的错误,当然了,脚本是录制的。这个原因是录制的脚本中remote应该写成大写开头Remote就可以了。
 
25、 - Error occurred: ApplicationVerificationFailed
这个是当我们试图通过终端命令ideviceinstaller -i 包的路径把App装到真机上的时候出现的,原因是我们的包是模拟器包,只能在模拟器上安装,需要让开发人员打一个真机包才能使用。
 
26、命令行npm install -g appium 安装appium报错
明明是按照官网的教程来的,可是这一步就总是出错,是不是很着急?这里有一个巨坑,npm版本如果是最新(5.3.0)的则无法安装,会一直报错,所以需要给npm降低版本:
npm install npm@4 -g
如果这一步出错,那就需要先清除npm缓存:
npm cache clean
如果这一步也出错,那就试试:
npm cache verify
然后再降低版本
 
27、各个测试环境的搭建
1、The XCUITest Driver(for iOS apps)
2、The UiAutomator2 Driver(for Android apps)
3、The Windows Driver(for Windows Desktop apps)
4、The Mac Driver(for Mac Desktop apps)
5、(BETA)The Espresso Driver(for Android apps)
该问题来自官网文档Getting Started
 
28、怎么获取 Android 应用的 appPackage 和 appActivity
电脑连接手机,打开 App
adb logcat | grep Displayed
adb logcat | grep ActivityManager
该问题答案来自博客
补充一个iPhone真机的Desired Capabilities截图,希望能够帮助有需要的朋友:
 
 
29、could not connect to server are you sure it's running?
出现这个问题的原因是 Server 选择错了。选的Customer Server, 换Automatic Server。如图:
 
 
30、An unknown server-side error occurred while processing the command. Original error: Could not install app: 'Command 'ios-deploy --id a1d83b4118076a91c432a49b123d7e40e7302332 --bundle /Users/guxuecheng/Desktop/sample-code/sample-code/apps/TestApp/build/Release-iphonesimulator/TestApp-iphonesimulator.app' exited with code 253'
报这个错的原因是因为测试用的安装包只能安装到模拟器上,如果试图安装到真机上就会报这个错误。
 
31、执行 Python 脚本如何选择 Python 版本
这个问题一般出现在 Mac 上,因为系统自带 Python2,而我们往往会再安装一个 Python3.这样在执行脚本的时候总是会默认使用 Python2,有时会导致脚本无法通过。只需要在脚本的头部加一行代码就可以了:
# !/usr/bin/python3
。在实际使用当中会报如下错误:
Cannot run program "/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6" (in directory "/Users/guxuecheng/Desktop/sample-code/sample-code/examples/python"): error=2, No such file or directory。
如图:
 
-----------------------------------------------------------------------------------
32、driver.contexts 获取H5信息,只能获取NATIVE_APP,获取不到webview
获取不到webview是应为没有获取web权限,需要开发在代码初始化的时候添加代码:
 
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
 
33、
 
 
本文内容总结来自:
 
 
posted @ 2018-08-29 15:35  清风的故事说  阅读(9878)  评论(1编辑  收藏  举报