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)
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