Compare commits
No commits in common. "6dfb1dde97a33bca160bdb89610cb50edcf92d52" and "d8af2a7e54829c92577874b77d2e8a647b8e35c3" have entirely different histories.
6dfb1dde97
...
d8af2a7e54
|
@ -1,30 +0,0 @@
|
||||||
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)
|
|
||||||
|
|
||||||
# 判断所有高亮单词是否有间隔
|
|
||||||
highlighteds = driver.find_elements_by_class_name("highlighted")
|
|
||||||
for highlighted in highlighteds:
|
|
||||||
assert highlighted.value_of_css_property("padding") == '0px'
|
|
||||||
time.sleep(5)
|
|
||||||
finally:
|
|
||||||
# 测试结束后关闭浏览器
|
|
||||||
driver.quit()
|
|
||||||
|
|
Loading…
Reference in New Issue