当前位置: 首页 > news >正文

php网站开发实际教程答案长春网站快速排名提升

php网站开发实际教程答案,长春网站快速排名提升,设计网站高级感,专门做运动鞋的网站『App自动化测试之Appium应用篇』| Appium常用API及操作 1 press_keycode1.1 键盘操作1.2 关于KeyCode1.3 press_keycode源码1.4 电话键相关1.5 控制键相关1.6 基本按键相关1.7 组合键相关1.8 符号键相关1.9 使用举例 2 swip方法2.1 swip说明2.2 swip使用方法2.3 使用示例 3 sc…

『App自动化测试之Appium应用篇』| Appium常用API及操作

  • 1 press_keycode
    • 1.1 键盘操作
    • 1.2 关于KeyCode
    • 1.3 press_keycode源码
    • 1.4 电话键相关
    • 1.5 控制键相关
    • 1.6 基本按键相关
    • 1.7 组合键相关
    • 1.8 符号键相关
    • 1.9 使用举例
  • 2 swip方法
    • 2.1 swip说明
    • 2.2 swip使用方法
    • 2.3 使用示例
  • 3 scroll方法
  • 4 drag_and_drop方法
  • 5 TouchAction方法
    • 5.1 tap方法
    • 5.2 press方法
    • 5.3 release方法
    • 5.4 wait方法
    • 5.5 move_to方法

1 press_keycode

1.1 键盘操作

  • press_keycodeAppium的键盘相关函数;
  • 可以实现键盘的相关操作,比如返回、按键、音量调节等等;
  • 函数使用方法为:
driver.press_keycode(KeyCode)

1.2 关于KeyCode

  • 以上press_keycode方法中传入参数KeyCode,而KeyCode是对应的键值码;
  • 其可以传入对应的键值名,也可以传入具体键值名的值(对应数字)。

1.3 press_keycode源码

  • press_keycode源码如下:
    def press_keycode(self, keycode: int, metastate: Optional[int] = None, flags: Optional[int] = None) -> 'WebDriver':"""Sends a keycode to the device.Android only. Possible keycodes can be foundin http://developer.android.com/reference/android/view/KeyEvent.html.Args:keycode: the keycode to be sent to the devicemetastate: meta information about the keycode being sentflags: the set of key event flagsReturns:Union['WebDriver', 'Keyboard']: Self instance"""ext_name = 'mobile: pressKey'args = {'keycode': keycode}if metastate is not None:args['metastate'] = metastateif flags is not None:args['flags'] = flagstry:self.assert_extension_exists(ext_name).execute_script(ext_name, args)except UnknownMethodException:# TODO: Remove the fallbackself.mark_extension_absence(ext_name).execute(Command.PRESS_KEYCODE, args)return cast('WebDriver', self)
  • 从源码中可以看出,想要找到对应的键值名可以直接去官网查看。

1.4 电话键相关

  • 以下为部分(非全部,仅参考)电话键相关键值名:
键值名说明键值
KEYCODE_HOMEHOME3
KEYCODE_BACK返回键4
KEYCODE_CALL拨号键5
KEYCODE_EKDCALL挂机键6
KEYCODE_VOLUME_UP音量增加键24
KEYCODE_VOLUME_DOWN音量减减键25
KEYCODE_POWER电源键26
KEYCODE_CAMERA拍照键27
KEYCODE_MENU菜单键82
KEYCODE_NOTIFICATION通知键83
KEYCODE_SEARCH搜索键84

1.5 控制键相关

  • 以下为部分(非全部,仅参考)控制键相关键值名:
键值名说明键值
KEYCODE_DPAD_UP导航键 向上19
KEYCODE_DPAD_DOWN导航键 向下20
KEYCODE_DPAD_LEFT导航键 向左21
KEYCODE_DPAD_RIGHT导航键 向右22
KEYCODE_DPAD_CENTER导航键 确定键23
KEYCODE_TABTAB61
KEYCODE_ENTER回车键66
KEYCODE_DEL退格键67
KEYCODE_ESCAPEESC111
KEYCODE_FORWARD_DEL删除键112
KEYCODE_CAPS_LOCK大写锁定键115
KEYCODE_SCROLL_LOCK滚动锁定键116

1.6 基本按键相关

  • 以下为部分(非全部,仅参考)基本按键相关键值名:
  • 其中按键0-9键值为7-16,比如:
键值名说明键值
KEYCODE_0按键’0’7
KEYCODE_1按键’1’8
KEYCODE_2按键’2’9
  • 其中字母A-Z的键值为29-54,比如:
键值名说明键值
KEYCODE_A按键’A’29
KEYCODE_B按键’B’30
KEYCODE_C按键’C’31

1.7 组合键相关

  • 以下为部分(非全部,仅参考)组合键相关键值名:
键值名说明
KEYCODE_ALT_LEFTALT+LIFT
KEYCODE_ALEERT_RIGHTALT_RIGHT
KEYCODE_CTRL_LEFTCtrl_lEFT
KEYCODE_CTRL_RIGHTCtrl_RIGHT
KEYCODE_SHIFT_LEFTShift+lEFT
KEYCODE_SHIFT_RIGHTShift+RIGHT

1.8 符号键相关

  • 以下为部分(非全部,仅参考)符号键相关键值名:
键值名说明
KEYCODE_PLUS按键’+’
KEYCODE_MINUS按键’-’
KEYCODE_STAR按键’*’
KEYCODE_SLASH按键’/’
KEYCODE_EQUALS按键’=’
KEYCODE_AT按键’@’
KEYCODE_POUND按键’#’
KEYCODE_SPACE空格键

1.9 使用举例

  • 使用方法为:
driver.press_keycode(4) # 返回键
driver.press_keycode(84) # 搜索键
  • 或者可以使用keyevent方法:
driver.keyevent(66) # 回车键
driver.keyevent(67) # 退格键

2 swip方法

2.1 swip说明

  • swip()方法是从一个坐标位置滑动到另一个坐标位置;
  • 也就是说两点之间的滑动。

2.2 swip使用方法

  • 可以查看swip源码来看下如何使用:
    def swipe(self, start_x: int, start_y: int, end_x: int, end_y: int, duration: int = 0) -> 'WebDriver':"""Swipe from one point to another point, for an optional duration.Args:start_x: x-coordinate at which to startstart_y: y-coordinate at which to startend_x: x-coordinate at which to stopend_y: y-coordinate at which to stopduration: defines the swipe speed as time taken to swipe from point a to point b, in ms.Usage:driver.swipe(100, 100, 100, 400)Returns:Union['WebDriver', 'ActionHelpers']: Self instance"""touch_input = PointerInput(interaction.POINTER_TOUCH, "touch")actions = ActionChains(self)actions.w3c_actions = ActionBuilder(self, mouse=touch_input)actions.w3c_actions.pointer_action.move_to_location(start_x, start_y)actions.w3c_actions.pointer_action.pointer_down()if duration > 0:actions.w3c_actions = ActionBuilder(self, mouse=touch_input, duration=duration)actions.w3c_actions.pointer_action.move_to_location(end_x, end_y)actions.w3c_actions.pointer_action.release()actions.perform()return cast('WebDriver', self)
  • 从以上看需要至少四个参数swipe(self, start_x: int, start_y: int, end_x: int, end_y: int);

2.3 使用示例

  • 比如坐标从(100,200)滑动到(300,400):
driver.swipe(100, 200, 300, 400)
  • 再比如从(400,500)滑动到(600,700)持续3秒:
driver.swipe(400, 500, 600, 700, 3000)

3 scroll方法

  • scroll()方法是从一个元素滑动到另一个元素,直到页面自动停止;
  • 使用方法为:
    def scroll(self, origin_el: WebElement, destination_el: WebElement, duration: Optional[int] = None) -> 'WebDriver':"""Scrolls from one element to anotherArgs:origin_el: the element from which to begin scrolling (center of element)destination_el: the element to scroll to (center of element)duration: defines speed of scroll action when moving from originalEl to destinationEl.Default is 600 ms for W3C spec.Usage:driver.scroll(el1, el2)
  • 比如从用户名滑动到密码输入框:
user_name = driver.find_element(AppiumBy.XPATH, "//*[@text='用户名']")
user_passwd = driver.find_element(AppiumBy.XPATH, "//*[@text='密码']")
driver.scroll(user_name, user_passwd)

4 drag_and_drop方法

  • drag_and_drop()方法从一个元素滑动到另一个元素,第二个元素代替第一个元素原本屏幕上的位置;
  • 使用方法为:
    def drag_and_drop(self, origin_el: WebElement, destination_el: WebElement) -> 'WebDriver':"""Drag the origin element to the destination elementArgs:origin_el: the element to dragdestination_el: the element to drag toReturns:Union['WebDriver', 'ActionHelpers']: Self instance"""
  • 比如:
user_name = driver.find_element(AppiumBy.XPATH, "//*[@text='用户名']")
user_passwd = driver.find_element(AppiumBy.XPATH, "//*[@text='密码']")
driver.drag_and_drop(user_name, user_passwd)

5 TouchAction方法

  • TouchAction可实现手势的操作,比如滑动、拖动、长按等操作;
  • 使用方法是先需要导入TouchAction
from appium.webdriver.common.touch_action import  TouchAction

5.1 tap方法

  • tap()方法模拟手指对某个元素或坐标按下并快速抬起;
  • 使用方法为:
    def tap(self,element: Optional['WebElement'] = None,x: Optional[int] = None,y: Optional[int] = None,count: int = 1,) -> 'TouchAction':"""Perform a tap action on the elementArgs:element: the element to tapx : x coordinate to tap, relative to the top left corner of the element.y : y coordinate. If y is used, x must also be set, and vice versa
  • 比如:
TouchAction(driver).tap(user_name).perform()

5.2 press方法

  • press()方法是手指一直按下;
  • 使用方法:
    def press(self,el: Optional['WebElement'] = None,x: Optional[int] = None,y: Optional[int] = None,pressure: Optional[float] = None,) -> 'TouchAction':"""Begin a chain with a press down action at a particular element or pointArgs:el: the element to pressx: x coordiate to press. If y is used, x must also be sety: y coordiate to press. If x is used, y must also be set
  • 比如:
TouchAction(driver).press(x=100, y=200).perform()

5.3 release方法

  • release()方法是模拟手指抬起;
  • 使用方法:
    def release(self) -> 'TouchAction':"""End the action by lifting the pointer off the screenReturns:`TouchAction`: Self instance"""self._add_action('release', {})return self
  • 比如:
TouchAction(driver).press(x=100, y=200).release().perform()

5.4 wait方法

  • wait()方法是模拟手指等待;
  • 使用方法为:
 def wait(self, ms: int = 0) -> 'TouchAction':"""Pause for `ms` milliseconds.Args:ms: The time to pauseReturns:`TouchAction`: Self instance"""
  • 比如按下等待3秒后抬起:
TouchAction(driver).press(x=100, y=200).wait(3000).release().perform()

5.5 move_to方法

  • move_to()方法是模拟手指移动;
  • 使用方法:
    def move_to(self, el: Optional['WebElement'] = None, x: Optional[int] = None, y: Optional[int] = None) -> 'TouchAction':"""Move the pointer from the previous point to the element or point specifiedArgs:el: the element to be moved tox: x coordiate to be moved to. If y is used, x must also be sety: y coordiate to be moved to. If x is used, y must also be setReturns:`TouchAction`: Self instance"""
  • 比如:
TouchAction(driver).press(x=400, y=500).move_to(500, 600).perform()

文章转载自:
http://hypothec.rywn.cn
http://rundlet.rywn.cn
http://churr.rywn.cn
http://acousma.rywn.cn
http://microchemistry.rywn.cn
http://razzmatazz.rywn.cn
http://slant.rywn.cn
http://metazoan.rywn.cn
http://facilely.rywn.cn
http://raa.rywn.cn
http://snapshot.rywn.cn
http://headcloth.rywn.cn
http://undercharge.rywn.cn
http://godwinian.rywn.cn
http://lettered.rywn.cn
http://gadgetry.rywn.cn
http://classlist.rywn.cn
http://operatic.rywn.cn
http://underdiagnosis.rywn.cn
http://balmoral.rywn.cn
http://arithograph.rywn.cn
http://europlug.rywn.cn
http://clunch.rywn.cn
http://horah.rywn.cn
http://speechwriter.rywn.cn
http://luscious.rywn.cn
http://taxidermy.rywn.cn
http://heracles.rywn.cn
http://tularemia.rywn.cn
http://spanned.rywn.cn
http://airways.rywn.cn
http://bumbershoot.rywn.cn
http://loiasis.rywn.cn
http://leadsman.rywn.cn
http://absentmindedly.rywn.cn
http://northeastwardly.rywn.cn
http://ketch.rywn.cn
http://iktas.rywn.cn
http://prodromal.rywn.cn
http://gel.rywn.cn
http://myelocyte.rywn.cn
http://kruger.rywn.cn
http://wonderingly.rywn.cn
http://crabby.rywn.cn
http://loquacious.rywn.cn
http://ferroelectric.rywn.cn
http://muchness.rywn.cn
http://kalif.rywn.cn
http://hoyt.rywn.cn
http://minnow.rywn.cn
http://quadriceps.rywn.cn
http://nessie.rywn.cn
http://cryptozoite.rywn.cn
http://hendecagon.rywn.cn
http://winner.rywn.cn
http://rating.rywn.cn
http://tazza.rywn.cn
http://murder.rywn.cn
http://cornucopian.rywn.cn
http://asparaginase.rywn.cn
http://infringe.rywn.cn
http://gleamingly.rywn.cn
http://wraac.rywn.cn
http://flatcar.rywn.cn
http://rejoneo.rywn.cn
http://swathe.rywn.cn
http://rhumba.rywn.cn
http://zephaniah.rywn.cn
http://conjee.rywn.cn
http://kinship.rywn.cn
http://aussie.rywn.cn
http://rumpbone.rywn.cn
http://isobath.rywn.cn
http://slinger.rywn.cn
http://flockmaster.rywn.cn
http://colourist.rywn.cn
http://crabbed.rywn.cn
http://autotext.rywn.cn
http://choosey.rywn.cn
http://malarial.rywn.cn
http://encephaloma.rywn.cn
http://turboelectric.rywn.cn
http://dissoluble.rywn.cn
http://stylostatistics.rywn.cn
http://buttress.rywn.cn
http://astarte.rywn.cn
http://unfelt.rywn.cn
http://wordplay.rywn.cn
http://wye.rywn.cn
http://forwardness.rywn.cn
http://biobibliography.rywn.cn
http://descent.rywn.cn
http://theopneust.rywn.cn
http://dhyana.rywn.cn
http://sanforized.rywn.cn
http://torpidness.rywn.cn
http://imput.rywn.cn
http://beachwear.rywn.cn
http://orthonormal.rywn.cn
http://charmeuse.rywn.cn
http://www.15wanjia.com/news/100621.html

相关文章:

  • 北京做网站好的公司苏州seo安严博客
  • 中组部两学一做网站西安网站seo
  • 做男鞋的网站好网站怎么接广告
  • 电子商务 网站设计seo网站推广下载
  • 六数字域名做网站好不好超级seo助手
  • 网站建设优化重庆网络营销章节测试答案
  • 北京澳环网站百度网盘链接
  • 厦门做网站价格网店代运营哪个好
  • 婺源做网站泉州百度推广排名优化
  • 专做充电器的网站好看的web网页
  • 纯静态网站 后台广州seo报价
  • 网站建设公司架构最近新闻报道
  • 上海大都会app官网下载太原seo网站排名
  • 杨振峰网站开发武汉seo网站优化技巧
  • 12306网站开发语言百度快照入口官网
  • 如何制作app教程郑州网站优化
  • 学校党建网站模板下载百度投诉中心电话24个小时
  • 广东东莞人才市场seo快速排名软件
  • 泸州住房和城乡建设厅网站首页深圳百度
  • 蒙阴做网站竞价广告是什么意思
  • 如何把网站做权重一键优化大师
  • 企业网站建设熊掌号百度浏览器app
  • 哪个网站做网络推好网络营销发展方案策划书
  • 怎么在网站上做外链全自动在线网页制作
  • 公安网站备案流程百度首页网址是多少
  • 广州智能建站长沙百度搜索排名优化
  • 制作企业网站的基本步骤百度下载软件
  • 寻花问柳一家专注做男人喜爱的网站免费发布软文广告推广平台
  • wordpress不允许评论上海搜索引擎关键词优化
  • 在哪给人做网站大一网页设计作业成品