随笔 - 301  文章 - 27  评论 - 8  阅读 - 10万

UI自动化测试-43--WebDriver--AutoIT 组件介绍

 

 

借助AutoIT操作记事本 

 

 

 

 

借助AutoIT操作元素
 
知识拓展:
AutoIT官方文档:https://www.autoitscript.com/autoit3/docs/functions.htm
推荐一篇博文:https://blog.csdn.net/weixin_38389124/article/details/88909881
 
 
 
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time
import os
import win32api


'''
需要安装pywin32的包,然后引入win32api
'''

driver = webdriver.Chrome()
driver.get('http://sahitest.com/demo/saveAs.htm')
ele = driver.find_element_by_xpath('/html/body/a[1]')
ActionChains(driver).context_click(ele).perform()
time.sleep(2)
win32api.keybd_event(40,0,0,0)
time.sleep(1)
win32api.keybd_event(40,0,0,0)
time.sleep(1)
win32api.keybd_event(40,0,0,0)
time.sleep(1)
win32api.keybd_event(40,0,0,0)
time.sleep(1)
win32api.keybd_event(13,0,0,0)
time.sleep(1)

os.system("d:\\A\\77.exe")

time.sleep(5)
driver.quit()

 

 

 

 

posted on   寻不到花的蝶  阅读(161)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Ollama——大语言模型本地部署的极速利器
· 使用C#创建一个MCP客户端
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示