time.sleep(1)
parent
fcd2c83904
commit
d1589f6062
|
@ -9,10 +9,6 @@ from selenium.webdriver.common.action_chains import ActionChains
|
||||||
from helper import signup
|
from helper import signup
|
||||||
|
|
||||||
|
|
||||||
def has_punctuation(s):
|
|
||||||
return any(c in string.punctuation for c in s)
|
|
||||||
|
|
||||||
|
|
||||||
def select(driver):
|
def select(driver):
|
||||||
text_element = driver.find_element(By.ID, 'article')
|
text_element = driver.find_element(By.ID, 'article')
|
||||||
|
|
||||||
|
@ -26,7 +22,7 @@ def select(driver):
|
||||||
# 假设我们想要选择从第10个字符开始的5个字符
|
# 假设我们想要选择从第10个字符开始的5个字符
|
||||||
actions.click()
|
actions.click()
|
||||||
actions.perform()
|
actions.perform()
|
||||||
time.sleep(5)
|
time.sleep(1)
|
||||||
# 找到包含要选择文字的元素
|
# 找到包含要选择文字的元素
|
||||||
text_element = driver.find_element(By.ID, 'article_title')
|
text_element = driver.find_element(By.ID, 'article_title')
|
||||||
|
|
||||||
|
@ -62,7 +58,7 @@ def test_selected_second_word(driver, URL):
|
||||||
assert selected_words != "","选中单词被放置框中"
|
assert selected_words != "","选中单词被放置框中"
|
||||||
#再次选取
|
#再次选取
|
||||||
select(driver)
|
select(driver)
|
||||||
time.sleep(6)
|
time.sleep(1)
|
||||||
selected_second_words = driver.find_element(By.ID, 'selected-words').get_attribute('value')
|
selected_second_words = driver.find_element(By.ID, 'selected-words').get_attribute('value')
|
||||||
assert selected_second_words.strip() == "", "选中的单词被删除"
|
assert selected_second_words.strip() == "", "选中的单词被删除"
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue