# 获取各命令url地址

curl http://appium.io/docs/en/commands/device/app/is-app-installed/ 2>/dev/null | grep 'href="../../../[a-zA-Z]' | awk -F"\"" '{print $2}' | awk -F"../../.." '{print $2}' | awk -va="http://appium.io/docs/en/commands" '{print a$1}' > command.txt

# 抓取python示例命令
while read line; do curl $line 2>/dev/null | sed ':a ; N;s/\n/ / ; t a ; ' | awk -F "<pre><code class=\"python\">" '{print $2}' | awk -F "</code></pre>" '{print $1}'; done < command.txt > pythoncommand.txt

# 抓取java示例命令
while read line; do curl $line 2>/dev/null | sed ':a ; N;s/\n/ / ; t a ; ' | awk -F "<pre><code class=\"java\">" '{print $2}' | awk -F "</code></pre>" '{print $1}'; done < command.txt > javacommand.txt

java command content:

 // TODO
driver.executeScript("mobile: scroll", ImmutableMap.of("direction", "down"));
driver.quit();
driver.back();
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
String pageSource = driver.getPageSource();
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS);
ScreenOrientation orientation = driver.getOrientation();
driver.rotate(ScreenOrientation.LANDSCAPE);
driver.setLocation(new Location(49, 123, 10)); // Must be a driver that implements LocationContext
Set&lt;String&gt; logTypes = driver.manage().logs().getAvailableLogTypes();
LogEntries logEntries = driver.manage().logs().get("driver");
driver.setSetting(Setting.WAIT_FOR_IDLE_TIMEOUT, Duration.ofSeconds(5));
Map&lt;String, Object&gt; settings = driver.getSettings();
MobileElement elementOne = (MobileElement) driver.findElementByAccessibilityId("SomeAccessibilityID"); MobileElement elementTwo = (MobileElement) driver.findElementByClassName("SomeClassName");
List&lt;MobileElement&gt; elementsOne = (MobileElement) driver.findElementsByAccessibilityId("SomeAccessibilityID"); List&lt;MobileElement&gt; elementsTwo = (MobileElement) driver.findElementsByClassName("SomeClassName");
MobileElement el = driver.findElementByAccessibilityId("SomeId"); el.click();
MobileElement element = (MobileElement) driver.findElementByAccessibilityId("SomeAccessibilityID"); element.sendKeys("Hello world!");
MobileElement element = (MobileElement) driver.findElementByAccessibilityId("SomeAccessibilityID"); element.clear();
MobileElement element = (MobileElement) driver.findElementByClassName("SomeClassName"); String elText = element.getText();
List&lt;MobileElement&gt; element = (MobileElement) driver.findElementByAccessibilityId("SomeAccessibilityID"); String tagName = element.getTagName();
List&lt;MobileElement&gt; element = (MobileElement) driver.findElementByAccessibilityId("SomeAccessibilityID"); String tagName = element.getAttribute("content-desc");
MobileElement element = (MobileElement) driver.findElementByAccessibilityId("SomeAccessibilityID"); boolean isEnabled = element.isEnabled();
List&lt;MobileElement&gt; element = (MobileElement) driver.findElementByAccessibilityId("SomeAccessibilityID"); Rectangle rect = element.getRect();
List&lt;MobileElement&gt; element = (MobileElement) driver.findElementById("SomeId"); String cssProperty = element.getCssValue("style");
// Not supported
// Overrides the Java Object .equals method MobileElement elementOne = (MobileElement) driver.findElementByClassName("SomeClassName"); MobileElement elementTwo = (MobileElement) driver.findElementByClassName("SomeOtherClassName"); boolean isEqual = elementOne.equals(elementTwo);
String context = driver.getContext();
Set&lt;String&gt; contextNames = driver.getContextHandles();
Set&lt;String&gt; contextNames = driver.getContextHandles(); driver.context(contextNames.toArray()[1]); // ... driver.context("NATIVE_APP");
Actions action = new Actions(driver); action.moveTo(element, 10, 10); action.perform();
Actions action = new Actions(driver); action.moveTo(element); action.click(); action.perform();
Actions action = new Actions(driver); action.moveTo(element); action.doubleClick(); action.perform();
Actions action = new Actions(driver); action.moveTo(element); action.clickAndHold(); action.perform();
Actions action = new Actions(driver); action.moveTo(element); action.clickAndHold(); action.moveTo(element, 10, 10); action.release(); action.perform();
TouchActions action = new TouchActions(driver); action.doubleTap(element); action.perform();
TouchActions action = new TouchActions(driver); action.down(10, 10); action.move(50, 50); action.perform();
TouchActions action = new TouchActions(driver); action.down(10, 10); action.up(20, 20); action.perform();
TouchActions action = new TouchActions(driver); action.longPress(element); action.perform();
TouchActions action = new TouchActions(driver); action.scroll(element, 10, 100); action.perform();
TouchAction action = new TouchAction(driver); action.press(10, 10); action.moveTo(10, 100); action.release(); action.perform();
WebElement source = (MobileElement) driver.findElementsByAccessibilityId("SomeAccessibilityID"); WebElement target = (MobileElement) driver.findElementsByAccessibilityId("SomeOtherAccessibilityID"); Point source = dragMe.getCenter(); Point target = driver.findElementByAccessibilityId("dropzone").getCenter(); PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger"); Sequence dragNDrop = new Sequence(finger, 1); dragNDrop.addAction(finger.createPointerMove(Duration.ofMillis(0), PointerInput.Origin.viewport(), source.x, source.y)); dragNDrop.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg())); dragNDrop.addAction(finger.createPointerMove(Duration.ofMillis(700), PointerInput.Origin.viewport(),target.x, target.y)); dragNDrop.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg())); driver.perform(Arrays.asList(dragNDrop));
driver.switchTo().window("handle");
driver.close();
String windowHandle = driver.getWindowHandle();
Set&lt;String&gt; windowHandles = driver.getWindowHandles();
Dimension windowSize = driver.manage().window().getSize();
driver.manage().window().setSize(new Dimension(10, 10));
Point windowPosition = driver.manage().window().getPosition();
driver.manage().window().setPosition(new Dimension(10, 10));
driver.manage().window().maximize();
driver.get("http://appium.io/");
String url = driver.getCurrentUrl();
driver.back();
driver.forward();
driver.refresh();
Set&lt;Cookie&gt; allcookies = driver.manage().getCookies();
driver.manage().deleteAllCookies();
driver.switchTo().frame(3);
driver.switchTo().parentFrame();
((JavascriptExecutor) driver).executeAsyncScript("window.setTimeout(arguments[arguments.length - 1], 500);");
((JavascriptExecutor) driver).executeScript("window.setTimeout(arguments[arguments.length - 1], 500);");

python command content:

 self.driver.execute_script("mobile: scroll", {'direction': 'down'})
desired_caps = desired_caps = { 'platformName': 'Android', 'platformVersion': '7.0', 'deviceName': 'Android Emulator', 'automationName': 'UiAutomator2', 'app': PATH('/path/to/app') } self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
self.driver.quit()
desired_caps = self.driver.desired_capabilities()
self.driver.set_page_load_timeout(5000)
self.driver.implicitly_wait(5000)
self.driver.set_script_timeout(5000)
orientation = self.driver.orientation()
driver.orientation = "LANDSCAPE"
self.driver.set_location(49, 123, 10)
log_types = driver.log_types();
logs = driver.get_log('driver');
self.driver.get_settings
el = self.driver.find_element_by_accessibility_id('SomeAccessibilityID')
el = self.driver.find_elements_by_accessibility_id('SomeAccessibilityID')
self.driver.find_element_by_accessibility_id('SomeAccessibilityID').send_keys('Hello world!')
self.driver.find_element_by_accessibility_id('SomeAccessibilityID').clear()
el = self.driver.find_element_by_accessibility_id('SomeAccessibilityID') text = el.text
tagName = self.driver.find_element_by_accessibility_id('SomeAccessibilityID').tag_name
tagName = self.driver.find_element_by_accessibility_id('SomeAccessibilityID').get_attribute('content-desc')
self.driver.find_element_by_accessibility_id('SomeAccessibilityID').is_selected()
self.driver.find_element_by_accessibility_id('SomeAccessibilityID').is_enabled()
self.driver.find_element_by_accessibility_id('SomeAccessibilityID').is_displayed()
location = self.driver.find_element_by_accessibility_id('SomeAccessibilityID').location
# Not supported
cssProperty = self.driver.find_element_by_accessibility_id('SomeId').value_of_css_property("style")
# Not supported
el = self.driver.find_element_by_accessibility_id('SomeAccessibilityID') el.submit();
element = driver.switch_to.active_element
# TODO Python sample
context = driver.current_context # or context = driver.context
contexts = driver.contexts
webview = driver.contexts[1] driver.switch_to.context(webview) # ... driver.switch_to.context('NATIVE_APP')
actions = ActionChains(driver) actions.move_to_element(element) actions.click() actions.perform()
actions = ActionChains(driver) actions.move_to_element(element) actions.double_click() actions.perform()
actions = ActionChains(driver) actions.move_to_element(element) actions.click_and_hold() actions.perform()
from appium.webdriver.common.touch_action import TouchAction # ... actions = TouchAction(driver) actions.tap(element) actions.perform()
from appium.webdriver.common.touch_action import TouchAction # ... actions = TouchAction(driver) actions.double_tap(element) actions.perform()
from appium.webdriver.common.touch_action import TouchAction # ... actions = TouchAction(driver) actions.tap_and_hold(element) actions.move(50, 50) actions.perform()
from appium.webdriver.common.touch_action import TouchAction # ... actions = TouchAction(driver) actions.tap_and_hold(20, 20) actions.release(50, 50) actions.perform()
from appium.webdriver.common.touch_action import TouchAction # ... actions = TouchAction(driver) actions.long_press(element) actions.perform()
from appium.webdriver.common.touch_action import TouchAction # ... actions = TouchAction(driver) actions.scroll_from_element(element, 10, 100) actions.scroll(10, 100) actions.perform()
from appium.webdriver.common.touch_action import TouchAction from appium.webdriver.common.multi_action import MultiAction # ... a1 = TouchAction() a1.press(10, 20) a1.move_to(10, 200) a1.release() a2 = TouchAction() a2.press(10, 10) a2.move_to(10, 100) a2.release() ma = MultiAction(self.driver) ma.add(a1, a2) ma.perform()
from appium.webdriver.common.touch_action import TouchAction // ... actions = TouchAction(driver) actions.tap_and_hold(20, 20) actions.move_to(10, 100) actions.release() actions.perform()
self.driver.switch_to.window("handle")
self.driver.close()
window_handle = self.driver.current_window_handle()
window_handles = self.driver.window_handles()
handle_one_size = self.driver.get_window_size() handle_two_size = self.driver.get_window_size("handleName")
self.driver.set_window_size(10, 10)
url = self.driver.current_url()
self.driver.forward()
self.driver.refresh()
cookies = self.driver.get_cookies()
self.driver.add_cookie({name: 'foo', value: 'bar'})
self.driver.delete_all_cookies()
self.driver.switch_to.frame(3)
self.driver.switch_to.parent()
self.driver.execute_async_script(‘document.title’)
self.driver.execute_script(‘document.title’)

Linux--抓取Appium网站命令的更多相关文章

  1. Python多进程方式抓取基金网站内容的方法分析

    因为进程也不是越多越好,我们计划分3个进程执行.意思就是 :把总共要抓取的28页分成三部分. 怎么分呢? # 初始range r = range(1,29) # 步长 step = 10 myList ...

  2. 使用BurpSuite抓取HTTPS网站的数据包

    昨天面试,技术官问到了我如何使用BurpSuite抓取https网站的数据包,一时间没能回答上来(尴尬!).因为以前https网站的数据包我都是用Fiddler抓取的,Fiddlert自动帮我们配置好 ...

  3. 在Scrapy项目【内外】使用scrapy shell命令抓取 某网站首页的初步情况

    Windows 10家庭中文版,Python 3.6.3,Scrapy 1.5.0, 时隔一月,再次玩Scrapy项目,希望这次可以玩的更进一步. 本文展示使用在 Scrapy项目内.项目外scrap ...

  4. linux抓取top命令中数据的方法

    top在linux中是一个非常直观的命令,可以清晰地看到各进程对资源的使用情况.   但是如果你想从top命令展示中提取某些数据出来,如果想当然地使用这句命令: top|grep xxx 就会被卡住, ...

  5. python3+beautifulSoup4.6抓取某网站小说(四)多线程抓取

    上一篇多文章,是二级目录,根目录"小说",二级目录"作品名称",之后就是小说文件. 本篇改造了部分代码,将目录设置为根目录->作者目录->作品目录- ...

  6. Linux抓包工具tcpdump命令详解

    1.简介      用简单的话来定义tcpdump,就是:dump the traffic on a network,根据使用者的定义对网络上的数据包进行截获的包分析工具. tcpdump可以将网络中 ...

  7. python3+beautifulSoup4.6抓取某网站小说(三)网页分析,BeautifulSoup解析

    本章学习内容:将网站上的小说都爬下来,存储到本地. 目标网站:www.cuiweijuxs.com 分析页面,发现一共4步:从主页进入分版打开分页列表.打开分页下所有链接.打开作品页面.打开单章内容. ...

  8. python3+beautifulSoup4.6抓取某网站小说(一)爬虫初探

    本次学习重点: 1.使用urllib的request进行网页请求,获取当前url整版网页内容 2.对于多级抓取,先想好抓取思路,再动手 3.BeautifulSoup获取html网页中的指定内容 4. ...

  9. 用php实现一个简单的爬虫,抓取电影网站的视频下载地址

    昨天没什么事,先看一下电影,就用php写了一个爬虫在视频网站上进行视频下载地址的抓取,这里总结一下抓取过程中遇到的问题 1:通过访问浏览器来执行php脚本这种访问方式其实并不适合用来爬网页,因为要受到 ...

随机推荐

  1. maven的多环境配置

    <profiles> <profile> <id>dev</id> <activation> <activeByDefault> ...

  2. AES-128-CBC加密

    C#: public static string AesKey = "sgg45747ss223455"; /// <summary> /// AES加密 (128-C ...

  3. openURL调用其他程序(转)

    转自:http://blog.csdn.net/iefreer/article/details/8812708 一个应用程序,可以调用其它的应用程序的. 和其它应用程序进行通讯如果一个应用程序支持一些 ...

  4. SpringMVC -- 梗概--源码--贰--上传

    1.配置web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version=&qu ...

  5. vue-resource和vue-axios的简单使用方法

    两者其实差别不大,都是基于es6的Promise对象实现的方法 vue-resource: main.js => import Vue from 'vue'; import VueResourc ...

  6. ios开发之--tableview单选/多选实现(非tableview的editing状态)及默认选中

    实现思路比较简单,这里仅做记录: 直接上代码: 1,实现didSelectRowAtIndexPath方法 -(void)tableView:(UITableView *)tableView didS ...

  7. Greenplum-cc-web安装

    第一章 文档概述 1. 本安装手册描述适用于Greenplum4.0以上版本的安装Greenplum-cc-web操作 第二章 安装介质 针对Greenplum版本下载对应Greenplum-cc-w ...

  8. 浅谈PostgreSQL的索引

    1. 索引的特性 1.1 加快条件的检索的特性 当表数据量越来越大时查询速度会下降,在表的条件字段上使用索引,快速定位到可能满足条件的记录,不需要遍历所有记录. create table t(id i ...

  9. PHP代码审计笔记--任意文件下载漏洞

    在文件下载操作中,文件名及路径由客户端传入的参数控制,并且未进行有效的过滤,导致用户可恶意下载任意文件.  0x01 客户端下载 常见于系统中存在文件(附件/文档等资源)下载的地方. 漏洞示例代码: ...

  10. [Python] Python 之 function, unbound method 和 bound method

    首先看一下以下示例.(Python 2.7) #!/usr/bin/env python # -*- coding: utf-8 -*- class C(object): def foo(self): ...