|
@@ -140,12 +140,12 @@ class ArticleGenerator:
|
|
|
time.sleep(0.1)
|
|
|
website_input = div.find_element(By.TAG_NAME, 'mat-form-field').find_element(By.TAG_NAME, 'input')
|
|
|
try:
|
|
|
- website_input.send_keys(urls[0])
|
|
|
+ website_input.send_keys(url)
|
|
|
website_input.send_keys(Keys.RETURN)
|
|
|
except Exception as e:
|
|
|
print(f'Error: {e}')
|
|
|
# 使用 JavaScript 強制發送鍵盤事件
|
|
|
- driver.execute_script("arguments[0].value = arguments[1];", website_input, urls) # 將文字輸入到 input
|
|
|
+ driver.execute_script("arguments[0].value = arguments[1];", website_input, url) # 將文字輸入到 input
|
|
|
driver.execute_script("arguments[0].dispatchEvent(new Event('input'));", website_input) # 觸發 input 事件
|
|
|
print(f'成功輸入網址: {url}')
|
|
|
time.sleep(7)
|