使用selenium自动单击,使用by.xpath
您在下图中看到了这个小蓝色徽标吗?使用WebDriverWait我想自动单击此蓝色徽标,以打开那些离开喜欢的人的列表。
我使用了.xpath。,更精确://*[@ID =“ JSC_C_Z”]行不通。 Nota:我注意到此页面上的ID和范围看起来令人怀疑,因此也许每次它们都不一定是相同的。因此,也许我不认为ID =“ JSC_C_Z”将是可靠的。 您可能需要诉诸于
aria-labeld
在目标元素部门上的属性
我的代码是:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="jsc_c_z"]/span[1]/span/span/div'))).click()
这是我想打开的链接="https://www.facebook.com/FranzKafkaAuthor/posts/3985338151528881" rel="nofollow noreferrer">https://www.facebook.com/FranzKafkaAuthor/posts/3985338151528881.
重要的是:也许您必须使用Facebook登录,但是谁不想这样做会发布屏幕截图
我希望有人可以帮助我。谢谢
Do you see this little blue logo in the image below? Using WebDriverWait I would like to automatically click on this blue logo, in order to open the list of those who have left the likes.
I used By.XPATH., More precisely: //*[@id="jsc_c_z"]/span[1]/span/span/div
, but it doesn't work. NOTA :I've noticed that the IDs and ranges on this page look suspiciously obfuscated and so maybe they won't necessarily be the same every time. So maybe I don't think id = "jsc_c_z" that will be reliable. You may need to resort to using aria-labeld
of the attribute on the target element div.
My code is:
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="jsc_c_z"]/span[1]/span/span/div'))).click()
This instead is the link I would like to open https://www.facebook.com/FranzKafkaAuthor/posts/3985338151528881.
IMPORTANT: Maybe you have to enter with the Facebook login, but who does not want to do so will post a screenshot
I hope someone can help me. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你能尝试一下吗?
当我检查一下时,我找不到您提到的DIV标签。
Can you try this?
When I was checking this, I couldn't find the div tag you mentioned.