Genymotion、 uiautomatorviewer、 appium报错

Genymotion模拟器启动时报错:

Unable to start the virtual device.The virtual device got no IP address.The VirtualBox DHCP server has not assigned an IP address to the virtual device.To find a solution,please start VirualBox.

Genymotion、 uiautomatorviewer、 appium报错

解决办法:

 

1、以管理员身份运行Genymotion;

 我按照网上说的设置vm virtualBox的网络、网卡、DHCP等无效果,于是自己尝试启动虚拟机查看报错内容,发现是电脑未设置虚拟化导致的,而Genymotion却报的是网络问题,只能说考虑问题还是看根本靠谱些吧。

2、vm virtualBox正常启动该模拟器,查看具体报错信息

 

 Genymotion、 uiautomatorviewer、 appium报错

模拟器报的错:

 Genymotion、 uiautomatorviewer、 appium报错

 

 

 

进入电脑boss,设置虚拟化,后选择模拟器的版本,即可解决

 

 Genymotion、 uiautomatorviewer、 appium报错

 

 

 

 

 

Genymotion下载模拟器完成时,提示unable to create virtual device:failed to import ova file

1、以管理员身份运行Genymotion;

2、删除文件:

 

uiautomatorviewer.bat打开报错:

Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn‘t exist!

解决办法:

关闭appium重新捕获app界面;

 

appium 1.4 使用desired_caps[‘unicodeKeyboard‘] = True 会报错,是因为重复安装了UnicodeIME-debug.apk 报错如下:

selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not be created. (Original error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "F:\xxx\android-sdk-windows\platform-tools\adb.exe -s P1QRMW6136 install "F:\xxx\Appium\node_modules\appium\build\unicode_ime_apk\UnicodeIME-debug.apk""
Failed to install F:\xxx\Appium\node_modules\appium\build\unicode_ime_apk\UnicodeIME-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.android.ime without first uninstalling

解决办法:

cmd 可卸载adb install io.appium.android.ime

 

appium1.4 不支持android版本为7报错:

Attempt to re-install io.appium.settings without first uninstalling

解决办法:

 

解决方案:
1、修改C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js文件为下图

Genymotion、 uiautomatorviewer、 appium报错

 

2、修改C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js文件为下图
Genymotion、 uiautomatorviewer、 appium报错

 

this.shell_grep("ps", name, function (err, stdout) {
 
 
 
     if (err) {
 
 
 
     logger.debug("No matching processes found");
 
 
 
     return cb(null, []);
 
    }
 
ADB.prototype.shell_grep = function (cmd, grep, cb) {
 
 
 
    if (cmd.indexOf(") === -1) {
 
 
 
    cmd = " + cmd + ";
 
 
 
    }
 
 
 
   var execCmd = shell  + cmd + | grep  + grep;
 
 
 
   this.exec(execCmd, cb);
 
 
 
   };

 

 

appium 运行脚本,启动应用,弹出权限或其他弹出框:

解决办法:

 

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver = webdriver.Remote(http://localhost:4723/wd/hub, desired_caps)
# 判断是否有权限弹窗,根据关键字来确定
for i in range(5):
    alertWin = ("xpath", "//*[@text=‘去授权‘]")
    try:
        e = WebDriverWait(driver, 1, 0.5).until(EC.presence_of_element_located(alertWin ))
        e.click()
    except:
        pass

 

Genymotion、 uiautomatorviewer、 appium报错

上一篇:Android 9.0新特性


下一篇:在Activity,Service,Window中监听Home键和返回键的一些思考,如何把事件传递出来的做法!