PhantomJS在弹出窗口中执行JavaScript以提取数据 [英] PhantomJS executing JavaScript in a popup for data extraction
问题描述
所以我有一个网页,上面有一些人的照片.当您单击该人的照片时,将执行JavaScript,并弹出一个带有一些更详细信息的弹出窗口,例如说明等.
So I have a web page with some photos of people. When you click on a photo of the person the JavaScript is executed and produces a popup with some more detailed information such as a description etc.
每张照片的链接如下:
<a href="javascript:void(0)" data="10019" class="seeMore"></a>
首先,我想从基础知识开始,即从一个人中提取描述等.因此,我想执行上面的JavaScript来编写弹出窗口,然后,当我进入弹出窗口时,可以提取弹出窗口中div's
的内容.
First I want to start with the basics, of just extracting the description etc. from one single person. So I want to execute the JavaScript above to write the popup window, and when I'm on the popup window I can then extract the content of the div's
on the popup.
我看过PhantomJS,但我真的不知道从哪里开始.我已经使用Cheerio从页面中获取一些简单的信息,并且我想继续通过JS执行弹出窗口,然后从中提取数据.
I've looked at PhantomJS and I really don't know where to start. I've used Cheerio to get some simple information from the page, and I want to move on to executing the popup window through JS and then extracting data from that.
任何帮助都将不胜感激,因为我通常是新手,可以进行屏幕抓取.
Any help would be appreciated as I'm a bit of a newbie to screen scraping in general.
推荐答案
您可以类似于 CasperJS 是
在离开主页之前,请不要忘记覆盖/清空 Do not forget to overwrite/nullify 这篇关于PhantomJS在弹出窗口中执行JavaScript以提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!page.onPageCreated
.page.onPageCreated
before navigating away from the main page.