1.Appium Error
issue: ...could not proxy command to remote server...
solution: re start appium server(desktop or command)
2.为了开发Appium iOS自动化测试脚本,需要使用Apple开发者账号。如果账号没有怎么办?下面是解决方案和步骤。
Step1:创建Apple ID账号。
步骤为【https://appleid.apple.com/#!】-【创建您的 Apple ID】-【填写信息,完成Flow】-【设置个人用户名和密码-如xxx@xxx.com,Devops123】
Step2: 在Apple开发者网站,通过Apple ID,完成注册。成为一名Apple开发者中一员。
步骤为【https://developer.apple.com/】-【Account】-【填写信息,完成Flow】-【Join the Apple Developer Program】-【Enroll】-【完成Enroll Flow】
3. Appium iOS自动化测试,需要有个操作,就是在iOS设备上进行“信任”这个Apple ID用户
iOS手机上执行如下:【设置】-【通用】-【描述文件与设备管理】-【信任你的Apple ID】
不同手机操作/名称不同,但思路一致。即,手机中找到你的Apple ID进行信任操作即可。一般在【设置】中可以找到。
4. 出现报错类似于“Could not proxy command to remote server”
问题:WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: socket hang up
方案:restart device
5. iOS设备上,不能Click某一个元素
问题: cannot click on iOS
解决: 用Click A Point方法。click a Point (instead of click button/click element as not clickable)
6.Android设备上,不能Click某一个元素
问题: cannot click on Android(如某个popup download)
解决:adb shell command (Input tap x y)- Click A Point
def close_download_popup():
adb1 = 'adb shell input tap 1010 1715'
os.system(adb1)
7. Android设备上,Mobile web 自动化测试时,报错类似“Original error: chrome not reachable”
问题:
WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: chrome not reachable
(Session info: chrome=86.0.4240.75)
解决: 因默认的60s timeout,把它设置0,则用不timeout
caps argument:${appium_newCommandTimeout} 0
Default 60(=60s),change to 0(=Never Stop)
8. Robot Framework同时使用AppiumLibrary和SeleniumLibrary开发包,但函数/关键字一样,报错。
问题:
比如Capture Page Screenshot关键字在两个包中都有定义,则报错:
“Keyword 'Capture Page Screenshot' could not be run on failure:
Multiple keywords with name 'Capture Page Screenshot' found. Give
the full name of the keyword you want to use:
AppiumLibrary.Capture Page Screenshot
Selenium2Library.Capture Page Screenshot.”
解决:(设置排序,指定报名.方法)
*** Settings ***
| Suite Setup | Set Library Search Order | AppiumLibrary | SeleniumLibrary
9.小数点精度问题 - decimal model
问题:某项目,进行交易的计算,需要有小数计算如2.9998-0.0001,计算结果不是期待的2.9997,而是2.99966666669
方案:这个是因为Python和CPU计算的科学计数方式不同。可以使用demical module,进行运算。RF的python拓展。
import decimal
def caculate_decimal(num1,num2):
a = str(num1)
b = str(num2)
c = decimal.Decimal(a) - decimal.Decimal(b)