Commit d279c021 by Administrator

修正1

parent 12dbb29f
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://rays7.5rs.me/login")
driver.find_element(By.XPATH,"//*[@id='userName']").send_keys("17373027967")
driver.find_element(By.XPATH,"//*[@id='pwd']").send_keys("Qwe123456")
driver.find_element(By.XPATH,"//*[@id='App']/div/div[1]/div[3]/div/div/div[3]/form/div[4]/div/div/div/div/button").click()
\ No newline at end of file
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://rays7.raysgo.com/login")
class LoginPage:
def login_username(self,username=None,password=None):
driver.find_element(By.XPATH, "//*[@id='userName']").send_keys(username)
driver.find_element(By.XPATH, "//*[@id='pwd']").send_keys(password)
driver.find_element(By.XPATH,
"//*[@id='App']/div/div/div[1]/div[3]/div/div/div[3]/form/div[4]/div/div/div/div/button").click()
time.sleep(10)
import pytest
from BasePage.login_page import LoginPage
# @pytest.fixture(scope="function",autouse=True)
# def fixture_test():
# """前后置处理"""
# # print('----测试开始----')
# # yield
# # print('----测试结束----')
# return "结束"
class Test_Login(LoginPage):
# 前后置条件
@pytest.fixture
def setup(self):
print("\nSetup - Before Test")
# 可以在这里进行一些初始化工作
# 如果有返回值,测试函数可以使用这个返回值
yield "Setup data"
# 后置条件 - 在测试运行后执行
print("\nTeardown - After Test")
# 可以在这里进行一些清理工作
def test_case01(self,setup):
LoginPage.login_username(self,username="17373027967",password="3149390154Li")
# 这是一个示例 Python 脚本。 # 这是一个示例 Python 脚本。
import pytest
# 按 Shift+F10 执行或将其替换为您的代码。 # 按 Shift+F10 执行或将其替换为您的代码。
# 按 双击 Shift 在所有地方搜索类、文件、工具窗口、操作和设置。 # 按 双击 Shift 在所有地方搜索类、文件、工具窗口、操作和设置。
def print_hi(name): pytest.main(['-s','-v'])
# 在下面的代码行中使用断点来调试脚本。 \ No newline at end of file
print(f'Hi, {name}') # 按 Ctrl+F8 切换断点。
# 按间距中的绿色按钮以运行脚本。
if __name__ == '__main__':
print_hi('PyCharm')
# 访问 https://www.jetbrains.com/help/pycharm/ 获取 PyCharm 帮助
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