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 ...
随机推荐
- LeetCode OJ--Longest Consecutive Sequence ***
http://oj.leetcode.com/problems/longest-consecutive-sequence/ 起初想的是排序,查了下O(n)的排序算法有计数排序.基数排序.桶排序.后来考 ...
- luogu P3808 【模板】AC自动机(简单版)
题目背景 这是一道简单的AC自动机模板题. 用于检测正确性以及算法常数. 为了防止卡OJ,在保证正确的基础上只有两组数据,请不要恶意提交. 管理员提示:本题数据内有重复的单词,且重复单词应该计算多次, ...
- Atcoder Grand Contest 024
A 略 B 略 C 略 D(构造分形) 题意: 给出一个由n个点的组成的树,你可以加一些点形成一个更大的树.对于新树中的两个点i和j,如果以i为根的树与以j为根的树是同构的那么i和j颜色可以相同.问最 ...
- SpringBoot 整合 RabbitMQ(包含三种消息确认机制以及消费端限流)
目录 说明 生产端 消费端 说明 本文 SpringBoot 与 RabbitMQ 进行整合的时候,包含了三种消息的确认模式,如果查询详细的确认模式设置,请阅读:RabbitMQ的三种消息确认模式 同 ...
- java判断日期与星期
原文:http://www.open-open.com/code/view/1440592372888 import java.text.SimpleDateFormat; import java.u ...
- Data.FireDACJSONReflect单元不支持跨平台
Data.FireDACJSONReflect不支持跨平台 Data.FireDACJSONReflect里面:IFDJSONDeltasApplyUpdates,TFDJSONDeltas,TFDJ ...
- MinGW在Windows环境下配合命令提示符运行C/C++
http://jingyan.baidu.com/article/4853e1e5787d6b1909f726f8.html 在电脑中配置MinGW环境. 具体参见我的另一篇分享经验——MinGW在W ...
- 【OpenGL】OpenGL帧缓存对象(FBO:Frame Buffer Object) 【转】
http://blog.csdn.net/xiajun07061225/article/details/7283929/ OpenGL Frame BufferObject(FBO) Overview ...
- 两点C#的propertyGrid的使用心得【转】
源文:http://www.cnblogs.com/bicker/p/3318934.html 最近接触C#的PropertyGrid比较多,得到了两个小心得记录一下. 第1点是关于控制Propert ...
- Spring HTTP Service
基于Spring MVC, 使用Http Service Invoke远程调用方法 (参考: http://blog.csdn.net/hanqunfeng/article/details/43031 ...