From d414eaa14454bca90e4b42efa8017fa3683752d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B3=E8=A9=A9=E7=A9=8E?= <1325912020@qq.com> Date: Tue, 25 Jun 2024 00:59:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20app/test/test=5Fbug555=5Fc?= =?UTF-8?q?henshiying.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug555_chenshiying.py | 34 ----------------------------- 1 file changed, 34 deletions(-) delete mode 100644 app/test/test_bug555_chenshiying.py diff --git a/app/test/test_bug555_chenshiying.py b/app/test/test_bug555_chenshiying.py deleted file mode 100644 index c7187f7..0000000 --- a/app/test/test_bug555_chenshiying.py +++ /dev/null @@ -1,34 +0,0 @@ -import pytest -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 -from selenium.webdriver.common.action_chains import ActionChains - -@pytest.fixture() -def driver(): - # 初始化Chrome WebDriver - driver = webdriver.Chrome() - driver.maximize_window() - yield driver - # 测试结束后关闭浏览器 - driver.quit() - -def test_bug555(driver): - base_url = "http://127.0.0.1:5000" - driver.get(base_url) - - # 定位文章元素并对其执行操作 - article = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'article'))) - ActionChains(driver).move_to_element(article).click_and_hold().move_by_offset(450, 200).release().perform() - print("Performed actions on article.") - - # 导航到下一篇文章 - next_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'load_next_article'))) - next_button.click() - print("Clicked next article button.") - - # 返回上一篇文章 - prev_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'load_pre_article'))) - prev_button.click() - print("Clicked previous article button.") \ No newline at end of file