• 【无标题】


    # 引入selenium

    from selenium import webdriver

    # 引入延迟时间

    from time import sleep
    class casetest(object):
    def init(self):
    # 打开谷歌浏览器
    self.browser = webdriver.Chrome()
    # 打开网址
    self.browser.get(“https://jmtest.jumingedu.com/qkyx”)
    # 延迟2秒
    sleep(2)

    #方法1  把谷歌浏览器放大
    def test_execoute1(self):
        self.browser.maximize_window()
        sleep(1)
    
    #点击学员登录
    def test_execoute2(self):
        self.browser.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[1]/div[2]/div[3]/div/div[4]/div[1]").click()
    # 输入手机号和密码和验证码
    # 点击登录
    def test_execoute3(self):
        self.browser.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div/div/div[1]/input").send_keys('19990000318')
        self.browser.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div/div/div[2]/input").send_keys('Jm@123456')
        self.browser.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div/div/div[3]/input").send_keys('8888')
        self.browser.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div/div/div[4]/button").click()
        sleep(5)
    #点击继续教育
    def test_execoute4(self):
        self.browser.find_element_by_xpath("/html/body/div[1]/div/div[1]/div[2]/div/div[1]/li[3]/div").click()
        sleep(2)
        # 点击图片进入详情页面
        self.browser.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[2]/div[1]/div/li[2]/div[1]").click()
        sleep(3)
        # 点击开始
        self.browser.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[1]/div/div[2]/div[2]/div[4]/div[1]/div/div[1]").click()
        sleep(3)
        # 点击开始播放
        self.browser.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[1]/div/div[2]/div[1]/div/div[1]/div[1]/div").click()
        sleep(3)
    
    • 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

    调用方法

    if name == ‘main’:
    # 调用casetest方法
    case = casetest()
    #调用 casetest中的test_execoute1
    case.test_execoute1()
    case.test_execoute2()
    case.test_execoute3()
    case.test_execoute4()

    import time

    桌面自动化

    import pyautogui as pya

    实时获取鼠标的当前位置

    try:
    while True:
    # 获取屏幕分辨率
    screenWidth, screenHeight = pya.size()
    # 获取鼠标位置
    x, y = pya.position()
    # 打印分辨率和鼠标位置
    print(“Screen size: (%s %s), Position : (%s, %s)\n” % (screenWidth, screenHeight, x, y))
    # 间隔三秒显示位置
    # time.sleep(3)
    n = 0;
    while n < 100:
    n = n + 100
    # 点击指定位置
    pya.click(971, 706)
    # time.sleep(1)
    pya.typewrite(‘cnm’)
    pya.click(1407, 786)
    time.sleep(1)
    except KeyboardInterrupt:
    print(‘end’)
    pya.click

  • 相关阅读:
    语法基础(数组)
    企业安全生产双重预防机制的构建和应用
    大学生抗击疫情感动人物最美逆行者网页设计作业 html抗疫专题网页设计 最美逆行者网页模板 致敬疫情感动人物网页设计制作
    Vue3源码解读之patch
    软件测试之写测试用例的好处
    科技的成就(五十二)
    html和css中图片加载与渲染的规则是什么?
    Vue.js核心技术解析与uni-app跨平台实战开发学习笔记 第7章 Vue.js高级进阶 7.7 watch侦听属性
    Charles的证书下载(web端)
    【核酸检测人员安排】python实现-附ChatGPT解析
  • 原文地址:https://blog.csdn.net/weixin_48992836/article/details/126827372