1
0
Fork 0

fix bug547

Bug547_FanWenQi
江贤婷 2024-06-14 21:08:15 +08:00
parent 9725dfb9ef
commit 54d4eabef1
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
from webdriver_helper import get_webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = get_webdriver()
driver.get('http://127.0.0.1:5000')
uname = "jxt"
password = "123456"
# def login(uname, password):
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, '登录'))).click()
driver.find_element(By.ID, 'username').send_keys(uname)
driver.find_element(By.ID, 'password').send_keys(password)
driver.find_element(By.XPATH, '//button[text()="登录"]').click()
WebDriverWait(driver, 10).until(EC.title_is(f"EnglishPal Study Room for {uname}"))
article = driver.find_element('xpath','//*[@id="article"]')
range_input = driver.find_element('xpath','//*[@id="rangeComponent"]')
# 使用 ActionChains 类来拖动 range input 元素
action_chains = ActionChains(driver)
action_chains.click_and_hold(article).move_by_offset(500, 0).release().perform()
action_chains.click_and_hold(range_input).move_by_offset(50, 0).release().perform()
input()