【发布时间】:2018-09-10 08:32:18
【问题描述】:
对于 chrome,我安装 ChroPath 以在页面上查找元素。
我想在 Instagram 页面上找到类似元素的 XPath,但似乎不起作用:
//span[contains(@class,'glyphsSpriteHeart__outline__24__grey_9 u-__7')]
我也试试:
/html[1]/body[1]/div[3]/div[1]/div[2]/div[1]/article[1]/div[2]/section[1]/span[1]/button[1]/span[1]
当硒点击时:
elenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"div._2dDPU.vCf6V div.zZYga div.PdwC2._6oveC article.M9sTE.L_LMM.JyscU div.eo2As section.ltpMr.Slqrh span.fr66n button.coreSpriteHeartOpen.oF4XW.dCJp8 > span.glyphsSpriteHeart__outline__24__grey_9.u-__7"}
如何找到 XPath?有什么好的扩展吗?
【问题讨论】:
-
分享 HTML 代码或网站链接。
-
@cruisepandey 它的 instagram 页面,我想要从网络上发布照片
-
可以分享HTML代码吗?
-
它的 instagram.com 和来自网络的任何照片。
标签: python selenium selenium-webdriver selenium-chromedriver