如何使用AbotX Javascriptrendering覆盖网页并在网页上执行操作 [英] How to overwrite and perform actions on webpage with AbotX Javascriptrendering
问题描述
我正在尝试使用 AbotX爬网程序来爬网需要渲染javascript并按a的网站跨度标签.
I am trying to use the AbotX crawler to crawl a site where I need to render the javascript and the press a span tag on it.
我已经使用了很多Abot搜寻器,并且期望像以前不得不扩展CrawlDecisionMaker一样,不得不覆盖某些类.
I've used the Abot crawler a lot and expected to having to overwrite some of the classes just as I have on previous occasions had to expand on for instance, the CrawlDecisionMaker.
但是我似乎找不到起点,我希望我必须写一些类似的东西:
But I can't seem to find out where to start, I expect I have to writing something like:
var implemnts = new ImplementationOverride(config);
implemnts.JavascriptRenderer = new PhantomJsRendererTest(config);
并扩展PhantomJsRenderer,使其能够单击渲染页面上的按钮.
and extend the PhantomJsRenderer to be able to get it to click a button on the rendered page.
但是由于我看不到现有类的作用或找不到有关从何开始的信息,所以我完全迷失了.
But since I can not see what the existing class does or find any information about where to start, I am completely lost.
我想在帖子Abot和AbotX上加标签,但我对此没有很高的声誉.
I wanted to tag the post Abot and AbotX, but I do not have the required reputation for that.
推荐答案
AbotX (使用IsJavascriptRenderingEnabled = true)将检索页面源代码并执行所有JavaScript以获取最终页面呈现.最终渲染包括所有内容(html/css),甚至包括使用javascript添加/修改的内容.它不允许您进一步执行javascript.
AbotX (with IsJavascriptRenderingEnabled = true) will retrieve the page source and execute all javascript to get a final page rendering. This final rendering includes all content (html/css) even content that was added/modified using javascript. It does not allow you to execute javascript any further.
如果您需要进一步与页面互动,则不太可能需要Web爬网程序.您可能需要使用浏览器自动化框架,例如 PhantomJs 或
If you need to interact with the page further then a web crawler is not likely what you need. You would need to use a browser automation framework like PhantomJs or Selenium. Those are headless browsers that will allow you to interact with the page just like you can in a browser.
这篇关于如何使用AbotX Javascriptrendering覆盖网页并在网页上执行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!