From 101c359596c75d60a700f52deb2d200a8452b27a Mon Sep 17 00:00:00 2001 From: "1994836463@qq.com" Date: Sun, 26 May 2024 11:32:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E5=B0=86tangxinyuan=E5=B0=8F=E7=BB=84?= =?UTF-8?q?=E7=9A=84=E6=B5=8B=E8=AF=95=E6=96=87=E4=BB=B6=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=EF=BC=8C=E5=8F=AA=E6=98=AF=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E7=82=B9=E5=87=BB=E6=8C=89=E9=92=AE=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E5=B0=86=E7=82=B9=E5=87=BB=E9=80=80?= =?UTF-8?q?=E5=87=BA=E6=8C=89=E9=92=AE=EF=BC=8C=E4=BD=BF=E7=94=A8ActionCha?= =?UTF-8?q?ins=E5=8E=BB=E7=82=B9=E5=87=BB=EF=BC=8C=E5=9B=A0=E4=B8=BA?= =?UTF-8?q?=E6=88=91=E6=B5=8B=E8=AF=95=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C?= =?UTF-8?q?=E7=94=A8driver=E5=8E=BB=E7=82=B9=E5=87=BB=E5=A4=A7=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BC=9A=E6=8A=A5=E5=87=BA'=E9=80=80=E5=87=BA'?= =?UTF-8?q?=E7=9A=84=E6=8C=89=E9=92=AE=E8=A2=AB=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E6=8B=A6=E6=88=AA=E7=9A=84=E9=94=99=E8=AF=AF=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug544_tangxinyuan.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/test/test_bug544_tangxinyuan.py b/app/test/test_bug544_tangxinyuan.py index 43bfa8c..729c857 100644 --- a/app/test/test_bug544_tangxinyuan.py +++ b/app/test/test_bug544_tangxinyuan.py @@ -1,5 +1,8 @@ import random import string +import time + +from selenium.webdriver 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 @@ -36,7 +39,8 @@ def test_save_selected_word(driver, URL): stored_words = driver.execute_script('return localStorage.getItem("selectedWords");') assert word == stored_words, "Selected word not saved to localStorage correctly" # 退出并重新登录以检查存储的单词 - driver.find_element(By.LINK_TEXT, '退出').click() + action_chains = ActionChains(driver) + action_chains.click(driver.find_element(By.LINK_TEXT, '退出')).perform() driver.execute_script("window.open('');window.close();") # 等待一会儿,让浏览器有足够的时间关闭标签页