[問題] 關於selenium 定位 ::before ::after元素消失

看板Python作者時間8年前 (2018/01/28 16:50), 8年前編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/1
請問一下各位大大, 最近在使用selenium 定位 ::before, 但一直取不到元素 我的版本 : python 3.6.4 selenium 3.8.1 chromedriver 2.34 以下是我的 html <div id="wx" class="container games"> ::before <div class="fancybox-loading"> <div class="loader"> <div class="loading_inner one"></div> <div class="loading_inner two"></div> <div class="loading_inner three"></div> </div> <div id="loadingText" class="loding_Text">加载中...</div> </div> ::after </div> python : driver.find_element_by_xpath("//*[@id='loadingText']") 會出下以下錯誤: NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector": "//*[@id='loadingText']"} 請問是我定位錯誤嗎? 不支援::before嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 202.39.9.79 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1517129403.A.6D9.html ※ 編輯: tas72732002 (202.39.9.79), 01/28/2018 16:52:22 ※ 編輯: tas72732002 (202.39.9.79), 01/28/2018 16:52:28

01/28 17:05, , 1F
o偶也想問@@
01/28 17:05, 1F

01/29 02:49, , 2F
::before 是 pseudo-element, 用 XPath 取不到, 但你這
01/29 02:49, 2F

01/29 02:50, , 3F
個不是 ::before (也不是 ::after), 取不到是其他原因
01/29 02:50, 3F
文章代碼(AID): #1QROwxRP (Python)