看板 Python 關於我們 聯絡資訊
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
clioshih: 推 08/01 10:47
clioshih: 我的查詢紐還是不能動耶 不過沒有跑到except的print了 08/01 10:53
hohiyan: or try search_button.submit() 08/01 12:17
clioshih: search_button.submit()也是不行T_T 08/01 15:36
clioshih: '//*[@id="search_bar1"]/div/input[@type="button"]' 08/01 16:31
clioshih: Xpath改成以上用search_button.click()也可以了,謝謝你 08/01 16:32