logo素材库网站免费,百度网站检测,清除wordpress标志,湘潭学校网站建设 z磐石网络airTest的第三方类库中有图像实别功能#xff0c;根据官网的介绍#xff0c;这个功能是能够在Windows上用来定位元素#xff0c;进行操作的。尝试过以下脚本#xff0c;发现真的可以。 from selenium.webdriver.chrome.options import Options
from selenium import webdri…airTest的第三方类库中有图像实别功能根据官网的介绍这个功能是能够在Windows上用来定位元素进行操作的。尝试过以下脚本发现真的可以。 from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from selenium import *
import os
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
import win32gui
from airtest.core.api import *
from airtest.cli.parser import cli_setup# 打开chrome 浏览器可以用别的方式打开我这里用webdriver。
driver webdriver.Chrome(executable_pathC:\\Users\\xx.xxxx\\Documents\\AutoTesting\\xxxxxxxx\\chromedriver.exe)# 返回窗口标题为data:, - Google Chrome的句柄.这里是提前写好的因为知道每次打开chrome的时候都会显示这个窗口标题。
hld win32gui.FindWindow(None, data:, - Google Chrome)
shld str(hld)# 这是airtest 连接chrome窗口的关键步骤。将刚刚取到的句柄传入连接airtest
if not cli_setup():auto_setup(__file__, logdirTrue, devices[Windows:/// shld])# 下面就可以实行点击等操作了。在chrome窗口中寻找预先截好的图--tpl1559122892842.png 这张图要放在工程内。一旦寻找到就会点击也就是touch操作。
touch(Template(rtpl1559122892842.png, record_pos(0.16, -0.011), resolution(1391, 746)))
touch(Template(rtpl1559122886202.png, record_pos(0.244, -0.092), resolution(1391, 746)))# 直接text操作在目前光标所在的位置执行。所以执行这一步之前要在上一步先以touch的方式将光标移在目标输入框内。
text(www.baidu.com)
touch(Template(rtpl1559123207157.png, record_pos(0.315, -0.116), resolution(1391, 746))) 转载于:https://www.cnblogs.com/testertry/p/10966017.html