# 获取各命令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. vue-resource和vue-axios的简单使用方法

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

  2. lua 按拉分析与合成

    -- 将数值分解成bytes_table local function decompose_byte(data) if not data then return data end local tb = ...

  3. 通过SSH实现Windows与linux之间传输文件

    Linux是非常好的开发环境,但很多时候我们希望能够在Windows上操作,通过SSH协议可以实现两者之间传输文件. 一 需要在Linux系统上安装ssh-server,有的linux系统自带了. 查 ...

  4. DNS原理入门

    原文链接:http://www.ruanyifeng.com/blog/2016/06/dns.html http://www.ruanyifeng.com/blog/2012/05/internet ...

  5. mybatis generator配置,Mybatis自动生成文件配置,Mybatis自动生成实体Bean配置

    mybatis generator配置,Mybatis自动生成文件配置,Mybatis自动生成实体Bean配置 ============================== 蕃薯耀 2018年3月14 ...

  6. Python 基础进阶

    函数的定义 函数的参数 函数的默认参数 函数的变量 函数的返回值 函数的多类型传值 函数的冗余参数 函数的递归调用 匿名函数 高阶函数 内建函数 模块与包 面向对象 类的定义 类的属性 类的内置属性 ...

  7. HTML 换行

    <br /> 标签可以用于换行 <!DOCTYPE HTML> <html> <body> <p> I like Playing. < ...

  8. 使用pyinotify监控文件系统的变化

    pyinotify依赖Linux内核inotify功能,它需要在2.6.13版本的内核的Linux系统上运行. 1. 安装pyinotify pip install pyinotify 安装完后可以直 ...

  9. mybatis 之 parameterType="Map"

    // 获得品牌下的商品 Map<String, Object> params = new HashMap<String, Object>(); params.put(" ...

  10. android新建的项目界面上没有显示怎么办?

    看log也没有说明具体情况? 一翻折腾在清单文件里加了权限就好了!!!