Summary
PhantomJS's capability of manipulating web pages is very flexible. We can do a lot more than just accessing the page itself. We can modify the look, change content on the fly, or even dynamically interact with its behavior as it was coded. In this chapter, we have tried to capture relevant data from an existing social media site and use it for any other purpose. This is just the beginning of what PhantomJS can do as far as interacting with web pages. We also touched a bit upon handling the status of pages and did a simple pausing. Using JavaScript's setTimeout
is just a simple workaround to let the background process complete. Proper handling of page events is also supported in PhantomJS, and we will be discussing them in the next chapter.