Skip to content

Run line of javascript code over multiple pages

I want to run a simple line of code:

document.getElementById('..').click();document.getElementById('..').click();

over multiple pages of the same website. I have a list of all those pages, I want to open the page, click those two elements and close the page over – 700 times. Can I possibly program chromium console to do that(taking into account loading times)?

Answer

You can use PhantomJS for this task.

Here is an article with very detailed explanations. Maybe it’s enough to look at the examples on PhantomJS page.