硒从HREF属性获取ABS URL
当我下载使用硒的页面并使用Java jsoup进行处理时。我在这样的源代码中获得了HREF:
< a href =“/f7-technical-trading” class =“ forumtitle”> gt; technology Trading</a>
是否有一种能够获得的方法来自此的绝对URL或迫使硒将其转换为绝对URL?获取页面后更新链接听起来并不像干净的解决方案。
when im downloading a page with selenium and process it with java jsoup. I get the hrefs in the source code like this:
<a href="/f7-technical-trading" class="forumtitle">Technical Trading</a>
Is there a way to get the absolute url from this or to force selenium to transform it to an absolute url? Updating the links after getting the page doesn't sound like a clean solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您仅使用硒获得HREF,则可以按预期工作:
这是一个快速示例:
输出包含:
这就是DOM外观的方式:(是相对的 - 但获取完整的路径)
If you get the href just with selenium, this works as expected:
This is a quick sample:
Output contains:
This is how the DOM looks: (it's relative - but gets the full path)