项目介绍

基于SpringBoot和Vue3框架开发的在线医疗咨询平台,实现对医疗资源的合理分配和优化管理,通过智能化的手段推动智慧医疗的发展,提高医疗服务的效率和质量,使得患者能够享受到更加便捷、高效的就医体验。

测试用例

根据姓名查询用户自动化测试代码(python+selenium)

import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import unittest

class EmployeeManagementTest(unittest.TestCase):

    def setUp(self):
        options = webdriver.ChromeOptions()
        options.add_experimental_option("detach", True)
        chrome_driver_path = "F:\\chrome_driver\\chromedriver-win64\\chromedriver.exe"
        self.driver = webdriver.Chrome(executable_path=chrome_driver_path, options=options)

    def test_add_employee(self):
        try:
            self.driver.get("http://localhost:9999/home")

            # 点击“系统管理”下拉菜单
            system_management = WebDriverWait(self.driver, 10).until(
                EC.element_to_be_clickable((By.XPATH, "//*[@id='app']/div/section/section/aside/ul/li[2]/div"))
            )
            system_management.click()

            # 点击“员工管理”
            employee_management = self.driver.find_element(By.XPATH, "//*[@id='app']/div/section/section/aside/ul/li[2]/ul/li[1]")
            employee_management.click()

            # 定位输入框并输入姓名

            name_input = WebDriverWait(self.driver, 10).until(
                EC.element_to_be_clickable((By.XPATH, "//*[@id='app']/div/section/section/section/main/main/form/div[2]/div/div/div/input"))
            )
            name_input.clear()
            name_input.send_keys('张三')
        
            # 点击查询按钮
            search_button = WebDriverWait(self.driver, 10).until(
                EC.element_to_be_clickable((By.XPATH, "//*[@id='app']/div/section/section/section/main/main/form/div[3]/div/button[1]"))
            )
            search_button.click()

            print("操作完成")

        except Exception as e:
            print(f"发生错误: {e}")

    # def tearDown(self):
    #     # 关闭浏览器
    #     self.driver.quit()

if __name__ == "__main__":
    unittest.main()

更多推荐