Commit 3d923ef6 by 齐文博

登录

parent 5ec630b0
import time
import action as action
# 安装selenium库
from selenium import webdriver
from selenium.webdriver.common.by import By
class Login:
# 把驱动对象存到成员变量中,方便调用
def __init__(self):
self.driver = webdriver.Edge()
# 打开网页
self.driver.get('https://adviser.raysgo.com/login')
self.driver.maximize_window()
# 账号输入框的元素对象
def find_user_name(self):
ele = self.driver.find_element(By.XPATH, '/html/body/div/div/div[1]/div/section/div/div[2]/form/div/div[1]/div/div/input')
return ele
# 密码输入框的元素对象
def find_password(self):
ele = self.driver.find_element(By.XPATH, '/html/body/div/div/div[1]/div/section/div/div[2]/form/div/div[2]/div/div/input')
return ele
#
def find_button(self):
ele = self.driver.find_element(By.XPATH, '/html/body/div/div/div[1]/div/section/div/div[2]/form/div/div[4]')
return ele
# 关闭浏览器
def quit(self):
self.driver.quit()
login = Login()
time.sleep(3)
login.find_user_name().send_keys("三味书屋")
time.sleep(3)
login.find_password().send_keys("Rmb123456")
time.sleep(3)
login.find_button().click()
time.sleep(3)
login.quit()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment