上传文件至 app/test
parent
cfd85a5035
commit
ea64351aa9
|
@ -0,0 +1,30 @@
|
|||
from selenium.webdriver.common.action_chains import ActionChains
|
||||
import time
|
||||
from helper import signup
|
||||
|
||||
def test_highlight(driver, URL):
|
||||
try:
|
||||
# 打开网页
|
||||
driver.maximize_window()
|
||||
driver.get(URL)
|
||||
|
||||
# 注册
|
||||
time.sleep(1)
|
||||
signup(URL, driver)
|
||||
time.sleep(2)
|
||||
|
||||
# 选中单词(移动鼠标到起点位置、按下鼠标左键、拖动鼠标到结束位置、释放鼠标左键、执行操作链)
|
||||
article = driver.find_element_by_id("article")
|
||||
actions = ActionChains(driver)
|
||||
actions.move_to_element(article).click_and_hold().move_by_offset(450,60).release().perform()
|
||||
time.sleep(1)
|
||||
|
||||
# 判断所有高亮单词是否有间隔
|
||||
marks = driver.find_elements_by_tag_name("mark")
|
||||
for mark in marks:
|
||||
assert mark.value_of_css_property("padding") == '0px'
|
||||
time.sleep(5)
|
||||
finally:
|
||||
# 测试结束后关闭浏览器
|
||||
driver.quit()
|
||||
|
Loading…
Reference in New Issue