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

织梦网站怎么上传视频教程网站如何在百度做排名

织梦网站怎么上传视频教程,网站如何在百度做排名,做网站 你的出路在哪里,百度地图开放平台一、环境搭建及准备工作 1、Appium 2 环境搭建 请参考另一篇文章: Windows系统搭建Appium 2 和 Appium Inspector 环境 2、安装 Appium-Python-Client#xff0c;版本要求3.0及以上 pip install Appium-Python-ClientVersion: 3.1.03、手机连接电脑#xff0c;并在dos窗口…一、环境搭建及准备工作 1、Appium 2 环境搭建 请参考另一篇文章: Windows系统搭建Appium 2 和 Appium Inspector 环境 2、安装 Appium-Python-Client版本要求3.0及以上 pip install Appium-Python-ClientVersion: 3.1.03、手机连接电脑并在dos窗口启动 Appium Server 4、演示环境APP软件ES文件浏览器 5、查看元素唯一方法 复制id点击搜索图标 选择id粘贴内容点击Search查看 二、编写自动化脚本 from appium import webdriver from appium.options.common.base import AppiumOptions from appium.webdriver.common.appiumby import AppiumBydef create_driver():AppiumOptions():用于配置 Appium 测试的通用选项可用于 Android 和 iOS 平台可以设置通用的测试选项如平台名称、版本、自动化引擎等# 创建 AppiumOptions 对象options AppiumOptions()# 加载测试的配置选项和参数(Capabilities配置)options.load_capabilities({# 自动化测试的引擎automationName: uiautomator2,# 平台名称platformName: Android,# 系统版本platformVersion: 11,# 设备的名称deviceName: RK3399,# 待测试应用的包名appPackage: com.estrongs.android.pop,# 待测试应用的活动Activity名称appActivity: .app.openscreenad.NewSplashActivity,# 设置使用 Unicode 编码方式发送字符串到设备的键盘unicodeKeyboard: true,# 设置重置设备的软键盘状态并隐藏键盘restKeyboard: true})# Appium服务器地址端口本地用http://127.0.0.1:4723appium_host http://192.168.100.15:4723return webdriver.Remote(appium_host, optionsoptions)def close_driver(driver):关闭驱动if driver:driver.quit()if __name__ __main__:driver create_driver()# 设置隐式等待时间为10秒driver.implicitly_wait(10)# 元素定位代码...# 关闭驱动close_driver(driver) 三、元素定位方式 1、根据id定位 # ID 定位方法 el driver.find_element(AppiumBy.ID, com.estrongs.android.pop:id/txt_grant) el.click()2、根据xpath定位 # xpath 方法 el1 driver.find_element(AppiumBy.XPATH, //android.widget.TextView[resource-idandroid:id/title and text密码设置]) el1.click()# xpath 简写方法 el2 driver.find_element(AppiumBy.XPATH, //*[text密码设置]) el2.click()3、根据class定位 (建议少用重复名称较多) # 使用class name定位 el3 driver.find_element(AppiumBy.CLASS_NAME, android.widget.ImageButton) el3.click()4、根据Accessibility ID定位 # 使用Accessibility ID定位 el4 driver.find_element(AppiumBy.ACCESSIBILITY_ID, 转到上一层级) el4.click()5、根据UIAutomator定位 UIAutomator元素定位是 Android 系统原生支持的定位方式虽然与 xpath 类似但比它更加好用且支持元素全部属性定位.定位原理是通过android 自带的android uiautomator的类库去查找元素。 Appium元素定位方法其实也是基于Uiautomator来进行封装的。 # 使用UIAutomator定位元素 (id定位) el5 driver.find_element(AppiumBy.ANDROID_UIAUTOMATOR, new UiSelector().resourceId(com.estrongs.android.pop:id/txt_grant)) el5.click()# 使用UIAutomator定位元素 (test定位) el6 driver.find_element(AppiumBy.ANDROID_UIAUTOMATOR, new UiSelector().text(搜索)) el6.click()# 使用UIAutomator定位元素 (class name定位) el7 driver.find_element(AppiumBy.ANDROID_UIAUTOMATOR, new UiSelector().className(android.widget.ImageButton)) el7.click()6、相同元素定位 如上图三个输入框的class属性都是一样的如果要根据class属性分别来获取这三个值就使用driver.find_elements方式。代码实现如下注意 driver.find_elements 多个 s # 使用class name和索引定位查找的元素列表中的特定元素 el8 driver.find_elements(AppiumBy.CLASS_NAME, android.widget.EditText) # 输入邮箱 el8[0].send_keys(123456789qq.com) # 输入验证码 el8[1].send_keys(654321) # 输入密码 el8[2].send_keys(123456)四、点击 - 输入 - 清空操作 # 运行ES文件浏览器软件并点击同意 el driver.find_element(AppiumBy.ID, com.estrongs.android.pop:id/txt_grant) el.click()# 单机操作(相当于鼠标点击)click() el1 driver.find_element(AppiumBy.XPATH, //*[text搜索]) el1.click()# 输入send_keys() el2 driver.find_element(AppiumBy.CLASS_NAME, android.widget.EditText) el2.send_keys(Android自动化)# 清空: clear() el3 driver.find_element(AppiumBy.CLASS_NAME, android.widget.EditText) el3.clear()五、swipe()方法模拟滑动操作 滑动操作是模拟用户在应用程序界面上进行手势滑动的操作。在Appium中可以使用swipe()方法来执行滑动操作。它需要指定起始点和终止点的坐标并且可以设置滑动的持续时间。滑动操作通常用于测试应用程序界面的可滚动性、页面切换和内容展示等功能。swipe(起始横坐标起始纵坐标目标横坐标目标纵坐标时间)时间指滑动使用多长时间单位为毫秒可为空(去掉duration****) 简单示例 # 获取屏幕宽度和高度 width driver.get_window_size()[width] height driver.get_window_size()[height]# 从下向上滑动屏幕 driver.swipe(width*0.5, height*0.9, width*0.5, height*0.1, duration500)# 从上向下滑动屏幕 driver.swipe(width*0.5, height*0.1, width*0.5, height*0.9, duration500)# 从右向左滑动屏幕 driver.swipe(width*0.9, height*0.5, width*0.1, height*0.5, duration500)# 从左向右滑动屏幕 driver.swipe(width*0.1, height*0.5, width*0.9, height*0.5, duration500)封装示例 class ScreenSlider():def __init__(self, driver):初始化屏幕滑动器self.driver driverdef get_screen_size(self):获取屏幕尺寸screen_size self.driver.get_window_size()return screen_size[width], screen_size[height]def swipe_up(self, duration500):从下向上滑动屏幕 x轴不变y轴变动width, height self.get_screen_size()self.driver.swipe(width*0.5, height*0.9, width*0.5, height*0.1, durationduration)def swipe_down(self, duration500):从上向下滑动屏幕 x轴不变y轴变动width, height self.get_screen_size()self.driver.swipe(width*0.5, height*0.1, width*0.5, height*0.9, durationduration)def swipe_left(self, duration500):从右向左滑动屏幕 x轴变动y轴不变width, height self.get_screen_size()self.driver.swipe(width*0.9, height*0.5, width*0.1, height*0.5, durationduration)def swipe_right(self, duration500):从左向右滑动屏幕 x轴变动y轴不变width, height self.get_screen_size()self.driver.swipe(width*0.1, height*0.5, width*0.9, height*0.5, durationduration) 文章持续更新中…
http://www.hkea.cn/news/14463873/

相关文章:

  • 永康网站定制怎么查询网站开发时间
  • 苏州网站关键词优化推广seo有哪些优化工具
  • 网站做项目qq是根据哪款软件开发的
  • 骨干专业群建设任务书网站太原网站排名外包
  • 福州网站开发哪家比较好网站即时到账要怎么做
  • 做网站好赚钱吗wordpress如何换图片
  • 广水网站设计怒火一刀代理平台
  • 做视频网站软件好用的海报设计网站
  • 工程网站模板制作教程医院关于建设官方网站的请示
  • 能看所有网站的浏览器企业官方网站的作用
  • 南阳做网站优化的公司视频怎样连接到wordpress
  • 企业站网页版的游戏
  • 百度移动网站检测高水平的郑州网站建设
  • asp程序网站后台发布产品的时候前台怎么不显示产品名称生成图片链接的网站
  • 株洲网站建设网站建设网站建设在作用是什么原因
  • 昌平区事业单位公共知识培训网站六年级做网站的软件
  • flash网站 seolinux wordpress 中文字体
  • 怎么才能创建个人网站成都户外网站建设
  • 怎么做存储网站建设网站的建设费用包括哪些内容
  • 模板网站什么意思wordpress 博客导航
  • 山东电子商务网站建设网站中英文版怎么做
  • 广州免费建站哪里有宝塔 wordpress 教程
  • 自己做的网站把密码改忘了怎么办怎么在阿里做网站
  • 网站登录密码怎么取消保存什么网站发布任务有人做
  • 石家庄网站建设培训学校中国农业工程建设协会网站
  • 温州知名网站thinkphp网站优化
  • 始兴生态建设网站wordpress seo h1标签
  • 别人给公司做的网站字体侵权吗百度有哪些app产品
  • 网站制作项目执行滁州做网站公司
  • 怎么看一个网站是用什么程序做的媒体网站模版