如何使用Selinium Python在JavaScript基础网站中输入/搜索文本?
我想在搜索字段中输入结果,并从输出页面中获取eircode/zipcode/postalcode。 nofollow noreferrer“> https://eircode-finder.com/search/ 和搜索地址清单,例如: 8旧的Bawn Court Tallaght都柏林 从结果中,我想获取eircode/zipcode/postalcode,然后将其保存在 .txt文件中 我已经使用了Beautifutsoup获取数据,但是即使是页面的HTML也没有获取。我不知道详细信息,但是网站上的某些内容像JavaScript这样的东西阻止了我从该网站获取数据。
I want to input result in search field and get the Eircode/zipcode/postalcode from output page. e.g: https://eircode-finder.com/search/
and search list of addresses like: 8 old bawn court tallaght dublin
and from results I want to fetch Eircode/zipcode/postalcode and save it in a .txt file
I have used beautifulsoup to fetch data, but Its not fetching even the html of the page.I don't know details but something is on the website like javascript which is preventing me to get data from that website.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用下一个示例如何向此页面请求API:
prints:
You can use next example how to make a request to this page api:
Prints:
提到的网站是使用
React
开发的,该需要JavaScript引擎渲染HTML页面。美丽的汤
只会发送请求,如果它的正常网站响应将是 html 强>需要JavaScript引擎才能渲染的数据。需要使用JavaScript引擎的网站可以用硒来取消,因为它使用实际的浏览器请求和加载页面。
您可以查看此视频可以帮助您更好地理解
Mentioned website is developed using
react
which requires javascript engine for rendering html pages.Beautiful Soup
just sends the request and take the response if it's normal website response will be HTML or else it will be JSON data which require javascript engine to render.Website which require javascript engine can be scrapped with selenium as it uses actual browser to request and load the page.
You can check out this video which can help you understand better