看板 Python 關於我們 聯絡資訊
https://imgur.com/a/ALoXGnR // 像是這樣下拉選單 下面程式碼我想選擇第7個頻道 select = Select(driver.find_element_by_name("channel_24")) select.select_by_visible_text("7") for op in select.options: print(op.text) 我程式碼印出來的下單選單都是空的~ 錯誤: selenium.common.exceptions.ElementNotVisibleException: Message: element not visible: Element is not currently visible and may not be manipulated 下面網址是我要用Select 讀取的 html 跟 下面是完整的錯誤訊息 https://gist.github.com/shihyu/d41512962cb35dea2dd8c369bdb0154b 因為我試過很多方式都無法選擇要的欄位 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 175.181.253.178 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1524461833.A.478.html
victor0929: 用xpath? 04/24 17:59
s860134: 這個是某家 router 的控制介面吧? 04/24 23:26
s860134: 其實你可以直接用 execute_script 直接對那個欄位操作... 04/24 23:27
rexyeah: 試試select_by_value() 而且你的select display:none ? 04/25 14:51
asglay: 先用requests讀出來, 再用beautifulsoup parsing出來 04/25 22:59
yshihyu: select_by_value 試過不行 ... select display直接是none 04/25 23:36
yshihyu: 找到原因了~要先用 execute_script把 display:設成block 04/25 23:45
yshihyu: 在用select 就可以~感謝 04/25 23:45