作者jacobcan118 (jacobcan118)
看板Python
標題[問題] 用python轉css selector到xpath
時間Sat Apr 22 05:00:07 2017
請問我想用selenium webdriver 去定位各個element. 我可以成功的找到element用xpath或是css select. 但是我有任何方法可以把css selector轉換成對應的xpath嗎
將我可以寫一個公用的functional
像
css select 是 find_element_by_css_selector('table.tableclassname')
xpath => find_element_by_xpath('//table[@class="tableclassname"]')
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 209.90.32.81
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1492808410.A.A57.html
→ uranusjr: pip install cssselect 04/22 09:25
→ jacobcan118: 謝謝.可以了 04/27 23:07