Compare commits
No commits in common. "e3db7c30b04335cc2fe1d345813697166ad3e4f4" and "d8af2a7e54829c92577874b77d2e8a647b8e35c3" have entirely different histories.
e3db7c30b0
...
d8af2a7e54
|
@ -8,13 +8,7 @@ function getWord() {
|
||||||
function fillInWord() {
|
function fillInWord() {
|
||||||
let word = getWord();
|
let word = getWord();
|
||||||
if (isRead) Reader.read(word, inputSlider.value);
|
if (isRead) Reader.read(word, inputSlider.value);
|
||||||
if (!isChoose) {
|
if (!isChoose) return;
|
||||||
if(isHighlight){
|
|
||||||
const element = document.getElementById("selected-words3");
|
|
||||||
element.value = element.value + " " + word;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const element = document.getElementById("selected-words");
|
const element = document.getElementById("selected-words");
|
||||||
localStorage.setItem('nowWords', element.value);
|
localStorage.setItem('nowWords', element.value);
|
||||||
element.value = element.value + " " + word;
|
element.value = element.value + " " + word;
|
||||||
|
|
|
@ -27,8 +27,6 @@ function highLight() {
|
||||||
let pickedWords = document.getElementById("selected-words"); // words picked to the text area
|
let pickedWords = document.getElementById("selected-words"); // words picked to the text area
|
||||||
let dictionaryWords = document.getElementById("selected-words2"); // words appearing in the user's new words list
|
let dictionaryWords = document.getElementById("selected-words2"); // words appearing in the user's new words list
|
||||||
let allWords = dictionaryWords === null ? pickedWords.value + " " : pickedWords.value + " " + dictionaryWords.value;
|
let allWords = dictionaryWords === null ? pickedWords.value + " " : pickedWords.value + " " + dictionaryWords.value;
|
||||||
highlightWords = document.getElementById("selected-words3");
|
|
||||||
allWords = highlightWords == null ? allWords : allWords + " " + highlightWords.value;
|
|
||||||
const list = allWords.split(" "); // 将所有的生词放入一个list中
|
const list = allWords.split(" "); // 将所有的生词放入一个list中
|
||||||
if(word !== null && word !== "" && word !== " "){
|
if(word !== null && word !== "" && word !== " "){
|
||||||
let articleContent_fb2 = articleContent;
|
let articleContent_fb2 = articleContent;
|
||||||
|
|
|
@ -166,7 +166,6 @@
|
||||||
<input id="selected-words2" type="hidden" value="{{ words }}">
|
<input id="selected-words2" type="hidden" value="{{ words }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<label id="selected-words3" type="hidden"></label>
|
|
||||||
{{ yml['footer'] | safe }}
|
{{ yml['footer'] | safe }}
|
||||||
{% if yml['js']['bottom'] %}
|
{% if yml['js']['bottom'] %}
|
||||||
{% for js in yml['js']['bottom'] %}
|
{% for js in yml['js']['bottom'] %}
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
from selenium.webdriver.common.action_chains import ActionChains
|
|
||||||
from helper import signup
|
|
||||||
|
|
||||||
|
|
||||||
def test_highlight(driver, URL):
|
|
||||||
try:
|
|
||||||
# 打开网页
|
|
||||||
driver.get(URL)
|
|
||||||
driver.maximize_window()
|
|
||||||
|
|
||||||
# 注册
|
|
||||||
signup(URL, driver)
|
|
||||||
|
|
||||||
# 取消勾选“划词入库按钮”
|
|
||||||
highlight_checkbox = driver.find_element_by_id("chooseCheckbox")
|
|
||||||
driver.execute_script("arguments[0].click();", highlight_checkbox)
|
|
||||||
|
|
||||||
article = driver.find_element_by_id("article")
|
|
||||||
|
|
||||||
# 创建 ActionChains 对象
|
|
||||||
actions = ActionChains(driver)
|
|
||||||
|
|
||||||
# 移动鼠标到起点位置
|
|
||||||
actions.move_to_element(article)
|
|
||||||
# actions.move_to_element_with_offset(article, 50, 100)
|
|
||||||
# 按下鼠标左键
|
|
||||||
actions.click_and_hold()
|
|
||||||
# 拖动鼠标到结束位置
|
|
||||||
actions.move_by_offset(400,50)
|
|
||||||
# 释放鼠标左键
|
|
||||||
actions.release()
|
|
||||||
# 执行操作链
|
|
||||||
actions.perform()
|
|
||||||
# time.sleep(10)
|
|
||||||
|
|
||||||
assert driver.find_elements_by_class_name("highlighted") is not None
|
|
||||||
finally:
|
|
||||||
# 测试结束后关闭浏览器
|
|
||||||
driver.quit()
|
|
Loading…
Reference in New Issue