第一个循环:
此循环生成需要更新的单词列表
for text in current_word:
current_word_text = text.get_attribute('innerHTML')
current_word_truncated = current_word_text.replace('_', '')
current_word_length = len(current_word_text)
current_word_truncated_list = list(current_word_truncated)
current_word_letter_position = current_word_text.index(
current_word_truncated) + 1
words_length_list = [word for word in temp if len(
word) == current_word_length]
words_letter_list = [
word for word in words_length_list if current_word_truncated in word]
if '_' in current_word_text:
third_list = [word for word in words_length_list if all(
letter in word.lower() for letter in current_word_truncated_list)]
print(third_list)
第二个循环:
此循环使用selenium chrome webdriver将上述单词列表中的单词写入文本区域一段时间
timer = browser.find_elements_by_xpath('//*[@id="timer"]')
for txt in timer:
for item in third_list:
third_list = [word for word in words_length_list if all(
letter in word.lower() for letter in current_word_truncated_list)]
print(third_list)
text_input.send_keys(item)
time.sleep(1)
text_input.send_keys(u'\ue007')
timer_text = txt.get_attribute('innerHTML')
if int(timer_text) == 80:
break
timer_text = txt.get_attribute('innerHTML')
if int(timer_text) == 80:
break
目前没有回答
相关问题 更多 >
编程相关推荐