appium(12)-The starting of an app
Steps:
you have to prepare environment for Android. Details are provided here: http://appium.io/slate/en/master/?java#setup-(android)//准备安卓环境。
you have to download the desktop app for Windows or Mac OS X or install it using npm $ npm install -g appium or $ npm install appium@required_version//安装appium server。
it needs to launch the appium server. If you use the server installed via npm then
$ node the_path_to_js_file --arg1 value1 --arg2 value2 where the_path_to_js_file is the full path to appium.js file (if the node server version version <= 1.4.16) or main.js (if the node server version version >= 1.5.0). It is not necessary to use arguments. The list of arguments: http://appium.io/slate/en/master/?java#appium-server-arguments//启动appium server。
The starting of an app
It looks like creation of a common RemoteWebDriver instance.
Common capabilities provided by Java client
Android-specific capabilities provided by Java client
//范例一:启动一个app。
import java.io.File;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.MobileElement;
import java.net.URL; ...
File app = new File("The absolute or relative path to an *.apk file");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
//you are free to set additional capabilities
AppiumDriver<MobileElement> driver = new AndroidDriver<>(
new URL("http://target_ip:used_port/wd/hub"), //if it needs to use locally started server
//then the target_ip is 127.0.0.1 or 0.0.0.0
//the default port is 4723
capabilities);
//范例二:启动手机浏览器。
If it needs to start browser then:
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.remote.MobileBrowserType;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.remote.RemoteWebElement;
import java.net.URL; ...
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.CHROME);//使用谷歌浏览器
//if it is necessary to use the default Android browser then MobileBrowserType.BROWSER//使用自带浏览器
//is your choise
...
//you are free to set additional capabilities
AppiumDriver<MobileElement> driver = new AndroidDriver<>(
new URL("http://target_ip:used_port/wd/hub"), capabilities);
or
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.remote.MobileBrowserType;
import io.appium.java_client.remote.MobilePlatform;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL; ...
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.CHROME);
//you are free to set additional capabilities
RemoteWebDriver driver = new RemoteWebDriver(
new URL("http://target_ip:used_port/wd/hub"), capabilities);
appium(12)-The starting of an app的更多相关文章
- Appium python自动化测试系列之混合app实战(十一)
12.1 什么是混合App 12.1.1 混合app定义 什么是混合app,其实这个不言而喻,我们的app正常来说应该都是native的,但是实际工作中却不是,反正种种原因我们的app会有native ...
- appium 九宫格解锁招商银行手机客户端app
之前研究了一段时间的appium for native app 相应的总结如下: appium测试环境搭建 :ht ...
- 国外经典设计:12个漂亮的移动APP网站案例
优秀的移动应用程序网站是设计灵感的重要来源.从美丽的图像,合理的使用空白到排版和颜色的使用,似乎设计师都加倍努力以创造一些美好和独特的设计来推广自己的应用程序. 因此,在这篇文章中,我们已经聚集了13 ...
- Python&Appium实现滑动引导页进入APP
最近在研究安卓APP的自动化测试.首先遇到的问题是,当一个session建立的时候,最先进入的是欢迎页和引导页,引导页有三张,最后一张上显示"enter"按钮,点击才能进入主界面. ...
- python+appium 自动化1--启动手机京东app
出处:https://www.cnblogs.com/yoyoketang/p/6128735.html 前言: 环境搭建好了.接下来先体验下如何启动app--1.首先获取包名:2.然后获取launc ...
- Appium+python自动化2-启动百度app
一.前言 上一章节环境已经搭建好了,接下来就是需要启动APP,如何启动app呢?首先要获取包名,然后获取launcherActivity.获取这两个关键东西的方法很多,这里就不一一多说,小伙伴们可以各 ...
- Appium Python 四:怎样获取APP的Package以及Activity
看到一篇很好的博客:[Android测试][随笔]获得App的包名和启动页Activity 除了博客上的方法,我还找到两种方法: 方法一:aapt 前提需要使用SDK Manager.exe 下载 A ...
- appium+python自动化47-首次打开app权限弹窗问题
前言 用真机运行appium代码,首次打开app有的手机会出现权限弹窗问题,一般这种弹窗都是在引导页前面或者引导页后面出现.权限弹窗上面的按钮都是固定的, 只需要定位到"始终允许" ...
- Appium+python启动虚拟机上的app
查看appPackage和appActivity方法: 1.先在cmd命令行输入 adb logcat ActivityManager:I *:s 2.点击虚拟机启动app即可查看,/前是appPa ...
随机推荐
- python读取Excel实例
1.操作步骤: (1)安装python官方Excel库-->xlrd (2)获取Excel文件位置并读取 (3)读取sheet (4)读取指定rows和cols内容 2.示例代码 # -*- c ...
- 牛客网 Wannafly挑战赛9 C.列一列-sscanf()函数
C.列一列 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld 链接:https://www.now ...
- Codeforces 875C National Property(拓扑排序)
题目链接 National Property 给定n个单词,字符集为m 现在我们可以把其中某些字母变成大写的.大写字母字典序大于小写字母. 问是否存在一种方案使得给定的n个单词字典序不下降. 首先判 ...
- git常用语句
1.安装git,也适用于升级 yum -y install gcc zlib-devel openssl-devel curl-devel \ expat-devel gettext-devel pe ...
- jenkins的Pipeline代码流水线管理
1.新建一个pipline任务 2.自写一个简单的pipline脚本 a.Pipeline的脚本语法在Pipeline Syntax中,片段生成器,示例步骤中选择builf:Build a job b ...
- 3.【nuxt起步】-下面以一个SPA单页程序为例子
spa:single page applcation 1.components目录新建header.vue,footer.vue Header.vue Footer.vue Pages/index.v ...
- 随想录(fatfs的学习)
[ 声明:版权全部,欢迎转载,请勿用于商业用途. 联系信箱:feixiaoxing @163.com] 上学的时候就对文件系统非常有兴趣.可是苦于没有合适的fs代码能够学习.市面上的fs代码,要么太 ...
- fastjson中Map与JSONObject互换,List与JOSNArray互换的实现
1.//将map转换成jsonObject JSONObject itemJSONObj = JSONObject.parseObject(JSON.toJSONString(itemMap)); 将 ...
- Servlet 3.0的AsyncListener接口
Servlet 3.0的AsyncListener接口 作者:chszs,转载需注明. 博客主页:http://blog.csdn.net/chszs 一.Servlet 3.0介绍 Servlet ...
- angular - 使用es6等一些功能
app.module.ts var model = { user: 'Admin', items: [{ action: 'buy flowsers', done: false },{ action: ...