mac appium androidd怎么处理弹框

Appium - iOS8.0 Notification Allow 弹出框解决方法 - 操作系统当前位置:& &&&Appium - iOS8.0 Notification Allow 弹出框解决方法Appium - iOS8.0 Notification Allow 弹出框解决方法&&网友分享于:&&浏览:0次Appium - iOS8.0 Notification Allow 弹出框解决办法iOS8.0 Notification Allow 弹出框解决办法
作者: Max.Bai
时间: 2015/03
iOS8.0 Notification Allow 弹出框解决办法
话说,我们的应用升级了,xcode也升级了,开发把所有都升级了。。结果就是我的老版本的模拟器对有些输入框无法输入了。。。
各种搜。。。
Appium bug? (/appium/appium/issues/4286) 要1.3.6 解决,现在才1.3.5,查看版本历史,基本要1个月以后了。。。
老大说了,年前要解决这个问题。。。
好吧,换iOS8.0 试试,不错,可以输入了,哇哈哈,全换iOS8.0,就此正题开始了。。。
应用启动后就弹出了 *** Would like to Send You Notifications .......
尝试1:识别alert,写代码点掉他
抓取是没有问题的,XPath,name。。。都可以,结果就是执行的时候找不到,不到,不到到。。。
原来这个是系统的,无法操作
尝试2:capabilities 设置 autoAcceptAlerts
capabilities 设置连接
/appium/appium/blob/master/docs/en/writing-running-appium/caps.md
autoAcceptAlerts Accept iOS privacy access permission alerts (e.g., location, contacts, photos) automatically if they pop up. Default is false.
看起来不错,添加,执行,哇哈哈,果然KO了它, 各种执行,太完美了,,, 就在此时,没错,刚KO的alert,完全没有了,对没错,完全没有了,就连我自己app弹出来的alert也自动被KO了,太完美了,我都不用干活了,app自己alert的信息完全不给我验证的机会啊。。。
问题来了,怎么只点系统的alert,而漏掉app自己的链接,给我个验证的机会
尝试3: 设置autoAcceptAlerts, 等app开起来关掉 系统alert后,关闭autoAcceptAlerts
哇哈哈,太完美了,简直无法直视啊。。。
开干,set, start,update,等等,好像没有update,这是一条路走到黑啊(别笑话我,内部了解不透彻。。)
路都死了?继续各种搜。。。
冬天来了,春天也该来了,挖到宝了
/appium/appium/issues/4178
内容大概就是,这个,那个,然后。。。(还是自己看吧,我E文太烂,就不解释了)
尝试4:capabilities 设置 waitForAppScript
waitForAppScript The ios automation script used to determined if the app has been launched, by default the system wait for the page source not to be empty. The result must be a boolean e.g., target.elements().length & 0;, $.delay(5000);
设置waitForAppScript 为 $.delay(5000); $.acceptAlert(); 大概意思就是等待appOK的时候执行设置的js
执行,系统alert被KO, 然后,然后,App的alert保留,太完美了,完美了,美了。
就这样吧,理解有错误的,往大神指点。
12345678910
12345678910
12345678910 上一篇:下一篇:文章评论相关解决方案 1234567891011 Copyright & &&版权所有【Android自动化】Appium在Android平台实战训练(一)
【Android自动化】Appium在Android平台实战训练(一)
&出处: 搜狗测试
&作/译者: Gina
前几篇Appium的文章讲解了Appium的安装和运行,以及在安装运行过程中的报错及解决方案。从本章起,小编带领大家一起用Appium做一点事情。
要想点击操作一个app,我们需要获取到这个app的控件,定位元素的方法较多,有Appium Inspector,UI Automation Viewer等,我这里用的是UI Automation Viewer。
1、获取控件的工具
SDK/tools/uiautomatorviewer.bat
双击打开,如下:
注意:这个工具只能是在Android4.2以上的系统上使用。
读出的信息有:
resource-id
2、实现一些基本操作的代码
以下代码实现了启动搜狗浏览器,点击“菜单”,然后再点击“设置”,进入设置页面后,滑动到页面最下方,之后点击“下载路径更改”这样的一系列操作。
#coding=utf-8
from appium import webdriver
import unittest
from appium import webdriver
from time import sleep
import time
import urllib2
# Returns abs path relative to this file and notcwd
#PATH = lambda p: os.path.abspath(
#&&& os.path.join(os.path.dirname(__file__),p)
#点击设置中“下载路径更改”,验证直接进入路径设置界面,不会弹出路径选择框
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps[&platformVersion&] = '6.0.1'
desired_caps[&deviceName&] ='adc2b04'
#desired_caps[&deviceName&] ='4d005802acc22185'
#desired_caps[&deviceName&] =''
desired_caps[&appPackage&] ='sogou.mobile.explorer'
#desired_caps['appActivity'] = '.BrowserActivity'
desired_caps['appActivity'] = '.NoDisplayActivity'
driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
time.sleep(10)
#btnSkip =driver.find_element_by_id('sogou.mobile.explorer:id/btn_skip')
#print len(btnSkip)
#if len(btnSkip) & 0:
&&&#driver.find_element_by_id('sogou.mobile.explorer:id/btn_skip').click()
driver.find_element_by_id('sogou.mobile.explorer:id/toolbar_menu').click()
time.sleep(5)
driver.find_element_by_name('设置').click()
time.sleep(5)
#滑动到底,找到下载路径更改sogou.mobile.explorer:id/set_download_path
driver.swipe(700, , 200,1000)
time.sleep(5)
driver.find_element_by_id('sogou.mobile.explorer:id/set_download_path').click()
time.sleep(5)
以下是一个Appium Python API 中文版,这里为大家整理了Appium一些基本的操作,方便读者实现自己想实现的功能:
3、点击物理按键
有时候我们遇到一些需要点击手机物理返回按键,或者home键等操作,总结如下:
adb shell input keyevent
点击home键:
adb shell input keyevent 3
点击back键:
adb shell input keyevent 4
具体按键参考:&
4、运行过程中报错整理
【报错一】
Appium的log上:
python工具上:
C:\Python27\python.exeD:/python/appium/download/downloadmodule/downloadpath.py Traceback (most recent call last): & File&D:/python/appium/download/downloadmodule/downloadpath.py&, line 24,in &&& driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps) & File &build\bdist.win32\egg\appium\webdriver\webdriver.py&,line 36, in __init__ & File&C:\Python27\lib\site-packages\selenium-2.50.0-py2.7.egg\selenium\webdriver\remote\webdriver.py&,line 87, in __init__ &&& self.start_session(desired_capabilities, browser_profile) & File&C:\Python27\lib\site-packages\selenium-2.50.0-py2.7.egg\selenium\webdriver\remote\webdriver.py&,line 141, in start_session &&& 'desiredCapabilities': desired_capabilities, & File &C:\Python27\lib\site-packages\selenium-2.50.0-py2.7.egg\selenium\webdriver\remote\webdriver.py&,line 201, in execute &&& self.error_handler.check_response(response) & File&C:\Python27\lib\site-packages\selenium-2.50.0-py2.7.egg\selenium\webdriver\remote\errorhandler.py&,line 188, in check_response &&& raise exception_class(message, screen, stacktrace) mon.exceptions.WebDriverException: Message: A new session could notbe created. (Original error: sogou.mobile.explorer/.NoDisplayActivity neverstarted. Current: sogou.mobile.explorer/.BrowserActivity)
Process finished with exit code 1
解决方案:
(1)将设备信息和系统信息修改正确即可,由于我信息填写的还是之前用的手机,后期换了手机,忘记修改相应的信息,故其中的手机设置信息很重要。
(2)手机的控件没有刷新,需要用UI AutomatorViewer刷新一下
(3)退出浏览器,且重启Appium
【报错二】
python报错:
C:\Python27\python.exe D:/python/appium/download/downloadmodule/downloadpath.py Traceback (most recent call last): & File&D:/python/appium/download/downloadmodule/downloadpath.py&, line 27,in &&&driver.find_element_by_id('sogou.mobile.explorer:id/btn_skip') & File &C:\Python27\lib\site-packages\selenium-2.50.0-py2.7.egg\selenium\webdriver\remote\webdriver.py&,line 234, in find_element_by_id &&& return self.find_element(by=By.ID, value=id_) & File&C:\Python27\lib\site-packages\selenium-2.50.0-py2.7.egg\selenium\webdriver\remote\webdriver.py&,line 712, in find_element &&& {'using': by, 'value': value})['value'] & File&C:\Python27\lib\site-packages\selenium-2.50.0-py2.7.egg\selenium\webdriver\remote\webdriver.py&,line 201, in execute &&& self.error_handler.check_response(response) & File &build\bdist.win32\egg\appium\webdriver\errorhandler.py&,line 29, in check_response
mon.exceptions.NoSuchElementException:Message: An element could not be located on the page using the given searchparameters.
解决方案:
driver.find_element_by_id('sogou.mobile.explorer:id/btn_skip').click()
driver.find_element_by_id('sogou.mobile.explorer:id/toolbar_menu').click()
点击过程,有一个控件没有找到,写脚本要保证相应的控件存在。
该内容对我有帮助
1797 人阅读
欢迎给测试窝投稿或参与内容翻译工作,请邮件至。也欢迎大家通过新浪微博(@测试窝)或微信公众号(测试窝)关注我们,并与我们的编辑和其他窝友交流。
& 测试窝,促进软件测试领域知识的传播。
联系我们 QQ:
测试窝常年法律顾问: 王雄金律师 | 执业证号:80720你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
用RF+ appium,想点击connect button,但是却被输入密码时弹出的键盘界面给阻挡了,元素查不到,请问这么情况如何处理?如何隐藏android的键盘?跪求。
我查看过appiumlibrary了,有一个hide keybroad关键字,但是只支持ios,白激动了。
同时里面提供了一个press keycode,这个关键字有用吗?
使用go back
同样被这个问题卡住了 同感啊
用appium输入法,可以解决
用appium输入法,可以解决
要回复问题请先或
浏览: 3684
关注: 5 人966,690 八月 独立访问用户
语言 & 开发
架构 & 设计
文化 & 方法
您目前处于:
Appium中国行分享总结:当测试遇上机器人
Appium中国行分享总结:当测试遇上机器人
注意:,500+CTO技聚重新定义技术领导力!
Author Contacted
相关厂商内容
相关赞助商
QCon全球软件开发大会上海站,日-22日,上海宝华万豪酒店,!
告诉我们您的想法
允许的HTML标签: a,b,br,blockquote,i,li,pre,u,ul,p
当有人回复此评论时请E-mail通知我
允许的HTML标签: a,b,br,blockquote,i,li,pre,u,ul,p
当有人回复此评论时请E-mail通知我
允许的HTML标签: a,b,br,blockquote,i,li,pre,u,ul,p
当有人回复此评论时请E-mail通知我
赞助商链接
架构 & 设计
文化 & 方法
<及所有内容,版权所有 &#169;
C4Media Inc.
服务器由 提供, 我们最信赖的ISP伙伴。
北京创新网媒广告有限公司
京ICP备号-7
注意:如果要修改您的邮箱,我们将会发送确认邮件到您原来的邮箱。
使用现有的公司名称
修改公司名称为:
公司性质:
使用现有的公司性质
修改公司性质为:
使用现有的公司规模
修改公司规模为:
使用现在的国家
使用现在的省份
Subscribe to our newsletter?
Subscribe to our industry email notices?&&&&RF+Appium+Android环境搭建
RF+Appium+Android环境搭建
RF+Appium+Android环境搭建文档
嵌到我的页面
<input type="text" readonly="true" value="">
若举报审核通过,可奖励20下载分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
VIP下载&&免积分60元/年(1200次)
您可能还需要
课程资源下载排行

我要回帖

更多关于 appium 弹出框处理 的文章

 

随机推荐