第五章 . Selenium Web 自动化模块 - 【元素的定位】class属性定位

通过class 属性定位元素 (class 可能不止一个) el3 = driver.find_element(By.CLASS_NAME, 's_ipt') from selenium.webdriver.chrome.service import Service from selenium im

第五章 . Selenium Web 自动化模块 - 【元素的定位】name属性定位

1.通过 name 属性定位元素 语法 driver.find_element(By.NAME, 'wd') from selenium.webdriver.chrome.service import Service from selenium import webdriver from selen

第五章 . Selenium Web 自动化模块 - 【元素的定位】id属性定位

1.通过 id 属性定位元素 语法: from selenium.webdriver.common.by import By driver.find_element(By.ID, 'value') 参数: 传入标签属性中id的值 返回值: 返回一个元素对象 代码示例: from selenium.w

第五章 . Selenium Web 自动化模块 - 【浏览器操作】模拟页面相关操作


1.打开请求地址 from selenium import webdriver from selenium.webdriver.chrome.service import Service import time #1.如何打开网址 driver = webdriver.Chrome(service=

第五章 . Selenium Web 自动化模块 - 【浏览器操作】模拟浏览器相关操作


1.如何创建浏览器对象 from selenium import webdriver from selenium.webdriver.chrome.service import Service #1.创建浏览器对象 driver = webdriver.Chrome(service=Servic

第五章 . Selenium Web 自动化模块 - 介绍及环境安装


1.Selenium 模块介绍 浏览器操作模拟:如打开请求地址,浏览器最大化,关闭浏览器等操作 支持八种元素定位方式:id、name、class name、tagname、linktext、patial linktext、xpath、css selectol 支持各种对元素的操作:点击、输入、获取属

第四章 . Pyautogui 客户端自动化 -【实战练习】简单实现QQ客户端登录自动化脚本

1.脚本实践:QQ 客户端登录 代码实现: import time import pyautogui #cmd+space 打开聚焦搜索qq ,回车进入(键盘操作) pyautogui.press('shift') pyautogui.hotkey('command','space') time.

第四章 . Pyautogui 客户端自动化 -【图像定位】设置图像识别的超时时间、信任度、灰度


1.设置超时时间 minSearchTime 语法 #1.设置超时时间 res =pyautogui.locateOnScreen('./test3.png',minSearchTime=5,confidence=0.95) print(res) minSearchTime默认为 0 秒 2.设置信

第四章 . Pyautogui 客户端自动化 -【图像定位】获得图片在当前屏幕上中心坐标


1.获取截图在当前屏幕的位置 语法: import pyautogui pyautogui.locateOnScreen(pathName) 参数 pathName:截图图片的路径+名字 返回值 返回的是一个位置元组(top、left、width、height),如果匹配不到则返回None 示例

第四章 . Pyautogui 客户端自动化 -【图像定位】屏幕截图


1.全屏截图 语法: import pyautogui pyautogui.screenshot(pathName) 参数: pathName:截图保存的路径+名字 返回值: 返回一个 image 对象 示例: #全屏截图 # pyautogui.screenshot('./test.png')