从Chrome浏览器与Selenium获取约会
我想获取网页的每个帖子的日期,当我显示此说明的内容时:
代码:
dateShare = WebDriverWait(post, 100).until(EC.presence_of_element_located((By.XPATH, ".//a[@class='oajrlxb2 g5ia77u1 qu0x051f esr5mh6w e9989ue4 r7d6kgcz rq0escxv nhd2j8a9 nc684nl6 p7hjln8o kvgmc6g5 cxmmr5t8 oygrvhab hcukyx3x jb3vyjys rz4wbd8a qt6c0cv9 a8nywdso i1ao9s8h esuyzwwr f1sip0of lzcic4wl gmql0nx0 gpro0wi8 b1v8xokw']")))
print("date :", BeautifulSoup(dateShare.get_attribute('innerHTML'), 'html.parser').text)
我获得此结果,例如:oesntpsrdoh800996H92THA15L07C1IC6T17H99 HI
i want get a date of each post of web pages, when i display content of this instruction:
code:
dateShare = WebDriverWait(post, 100).until(EC.presence_of_element_located((By.XPATH, ".//a[@class='oajrlxb2 g5ia77u1 qu0x051f esr5mh6w e9989ue4 r7d6kgcz rq0escxv nhd2j8a9 nc684nl6 p7hjln8o kvgmc6g5 cxmmr5t8 oygrvhab hcukyx3x jb3vyjys rz4wbd8a qt6c0cv9 a8nywdso i1ao9s8h esuyzwwr f1sip0of lzcic4wl gmql0nx0 gpro0wi8 b1v8xokw']")))
print("date :", BeautifulSoup(dateShare.get_attribute('innerHTML'), 'html.parser').text)
i get this result like : oeSntpsrdoh800996h92tha15l07c1ic6t17h99 hi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将网站或HTML代码放置吗?因为我不太了解。
只有我可以告诉你,当我在python .text中使用元素文本时。 示例
Could you put the website or the html code? Because I don't understand very well.
Only I can tell you that When I get the text of element I use in Python .text. Example