Compare commits

...

6 Commits

4 changed files with 34 additions and 5 deletions

View File

@ -185,9 +185,11 @@ function compareWord(first, second) {
/**
*
*
* 随机选取 10 个单词学习
*/
function random_select_word(word) {
alert("点击熟悉与不熟悉之后,单词自动返回生词库")
// 获取所有带有 "word-container" 类的 <p> 标签
const container = document.querySelector('.word-container');
@ -201,7 +203,7 @@ function random_select_word(word) {
// 将NodeList转换为数组
let wordContainersArray = [...wordContainers];
// 随机打乱数组
// 随机打乱数组,乱序
for (let i = wordContainersArray.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[wordContainersArray[i], wordContainersArray[j]] = [wordContainersArray[j], wordContainersArray[i]];

View File

@ -44,7 +44,7 @@
<a href="http://youdao.com/w/eng/{{x[0]}}/#keyfrom=dict2.index">{{x[0]}}</a> {{x[1]}}
{% endfor %}
{% endif %}
<p class="text-muted">Version: 20230810</p>
<p class="text-muted">Version: 20240618</p>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</div>
{{ yml['footer'] | safe }}

View File

@ -146,8 +146,8 @@
允许动态调整顺序
</label>
<br>
<a class="btn btn-info" style="background:red;color:#ffff" onclick="random_select_word('{{ word }}')" role="button">随机选取10个</a>
<a class="btn btn-info" style="background:red;color:#ffff" onclick="location.reload();" role="button">显示所有生词</a>
<a class="btn btn-primary btn-lg" onclick="random_select_word('{{ word }}')" role="button">随机选取10个</a>
<a class="btn btn-primary btn-lg" onclick="location.reload();" role="button">显示所有生词</a>
</p>
<a name="aaa"></a>
<div class="word-container">

View File

@ -0,0 +1,27 @@
import random
import string
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def test_bug561_LiangZiyue(driver, URL):
try:
driver.get(home)
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.LINK_TEXT, '登录'))).click()
driver.find_element(By.ID, 'username').send_keys("wrr")
driver.find_element(By.ID, 'password').send_keys("1234")
driver.find_element(By.XPATH, '//button[text()="登录"]').click()
ele = driver.find_element(By.XPATH,'//font[@id="article"]')
driver.execute_script('arguments[0].scrollIntoView();',ele)
action = ActionChains(driver)
action.click_and_hold(ele)
action.move_by_offset(0,500)
action.perform()
next_ele = driver.find_element(By.ID,'//button[@id="load_next_article"]')
driver.execute_script('arguments[0].scrollIntoView();',next_ele)
next_ele.click()
driver.execute_script('arguments[0].scrollIntoView();',ele)
ele.click()
finally:
driver.quit()