EnglishPal/app/test/test_bug551_DingZeYu.py

33 lines
1.1 KiB
Python
Raw Normal View History

import time
import pytest
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.alert import Alert
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from helper import signup
def test_bug551(driver, URL):
driver.maximize_window()
driver.get(URL)
username, password = signup(URL, driver)
article = driver.find_element(By.ID, 'article')
actions = ActionChains(driver)
actions.move_to_element(article)
actions.click_and_hold()
actions.move_by_offset(450, 200)
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"选中部分的单词的字体样式错误"
time.sleep(5)