1
0
Fork 0

删除 app/templates/test_bug536_QianLetao.py

Bug536-QianLetao
钱乐涛 2024-06-04 16:00:10 +08:00
parent c7511180a8
commit 496836fc00
1 changed files with 0 additions and 39 deletions

View File

@ -1,39 +0,0 @@
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.keys import Keys
import time
# 初始化WebDriver
driver = webdriver.Remote('http://localhost:4444/wd/hub', DesiredCapabilities.FIREFOX)
driver.implicitly_wait(10)
# 测试注册页面输入密码包含空格的情况
def test_signup_password_with_space():
try:
driver.get("http://127.0.0.1:5000/signup")
# 输入用户名
username_elem = driver.find_element_by_name('username')
username_elem.send_keys("阿萨德")
# 输入包含空格的密码
password_elem = driver.find_element_by_name('password')
password_elem.send_keys("阿萨德阿萨德")
# 再次输入密码
password2_elem = driver.find_element_by_name('password2')
password2_elem.send_keys("阿萨德阿萨德")
# 提交注册表单
password2_elem.send_keys(Keys.RETURN)
# 等待一段时间确保页面加载完成
time.sleep(2)
# 检查是否弹出警告框
alert = driver.switch_to.alert
assert "用户名和密码只能包含英文字母和数字!" in alert.text
finally:
driver.quit()