Re: [問題] selenium開網頁一直卡在查詢紐
1) search_button 那一行沒有找到正確的元件
可以改成 driver.find_element(By.XPATH, '//*[@id="search_bar1"]/div/input')
2) search_button.click() 改成 search_button.send_keys('\n')
至少這樣在我這邊是動得起來的
: try:
: ticker = '111'
: print(ticker,"Start searchinh!")
: keyword = driver.find_element(By.ID,"year")
: keyword.send_keys(ticker)
: search_button = driver.find_element(By.CSS_SELETOR,"#search_bar1 div.
: search input[type=button]")
: print(ticker,"test222")
: search_button.click()
: time.sleep(2)
: except:
: print(ticker,"Start searchinh2!")
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 35.10.41.97 (美國)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1690823458.A.D70.html
推
08/01 10:47,
1年前
, 1F
08/01 10:47, 1F
推
08/01 10:53,
1年前
, 2F
08/01 10:53, 2F
→
08/01 12:17,
1年前
, 3F
08/01 12:17, 3F
推
08/01 15:36,
1年前
, 4F
08/01 15:36, 4F
→
08/01 16:31,
1年前
, 5F
08/01 16:31, 5F
→
08/01 16:32,
1年前
, 6F
08/01 16:32, 6F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
Python 近期熱門文章
PTT數位生活區 即時熱門文章