From 9afd38a09a2a6ce01e378f97f0ca6b76808390a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=99=9F=E6=99=94?= <759539128@qq.com> Date: Mon, 20 May 2024 08:21:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/test/test=5Fbug551=5FD?= =?UTF-8?q?ingZeYu.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/test/test_bug551_DingZeYu.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/test/test_bug551_DingZeYu.py b/app/test/test_bug551_DingZeYu.py index 7c254c5..b4e292a 100644 --- a/app/test/test_bug551_DingZeYu.py +++ b/app/test/test_bug551_DingZeYu.py @@ -23,11 +23,14 @@ def test_bug551(driver, URL): actions.release() actions.perform() - # 获取选中部分的单词所应用的 CSS 样式 - highlighted_word_font_weight = article.value_of_css_property("font-weight") - - # 验证高亮显示的 CSS 样式是否符合预期 - expected_highlighted_word_font_weight = "300" - assert highlighted_word_font_weight == expected_highlighted_word_font_weight, f"选中部分的单词的字体样式错误" + # 获取选中部分的单词的HTML元素 + highlighted_words = driver.find_elements(By.CLASS_NAME, 'highlighted') + + # 验证选中部分的单词是否同时应用了需求样式 + expected_font_weight = "400" + + for word in highlighted_words: + font_weight = word.value_of_css_property("font-weight") + assert font_weight == expected_font_weight, f"选中部分的单词的字体样式错误" time.sleep(5) \ No newline at end of file