我用Selenium抓證交所重大訊息( https://mops.twse.com.tw/mops/web/t05st01 ) 的詳細內容,點下詳細資料的按鈕後,一直抓不到彈出新視窗的內容,不知是否有人可以幫忙?謝謝
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.service import Service
import time
PATH = "C:/chromedriver.exe"
service_obj = Service(PATH)
browser = webdriver.Chrome(service=service_obj)
browser.maximize_window()
browser.get( "https://mops.twse.com.tw/mops/web/t05st01" )
search = browser.find_element('xpath','//[@id="co_id"]')
search.send_keys('2330')
search = browser.find_element('xpath','//[@id="year"]')
search.send_keys('110')
search = browser.find_element('xpath',"//input[@type='button' and @value=' 查詢 ']").click()
time.sleep(3) #等待3s
btn_details =browser.find_elements('xpath','//*[@id="t05st01_fm"]/table/tbody/tr[4]/td[6]/input')[0] #詳細資料按鈕
btn_details.click()