Search code examples
javascriptjquery-selectorsphantomjscasperjsphantomcss

How to hide multiple elements with the hideElements argument in screenshot function of PhantomCSS


How to include more than one element in hideElements argument in screenshot function?

For one element:

phantomcss.screenshot(target, timeOut, "div.page", fileName);

Solution

  • You can use any jQuery selector as seen in the code. jQuery supports the comma operator that you should know from CSS selectors. Example:

    phantomcss.screenshot(target, timeOut, "div.page, span.smth, .advertisement", fileName);
    

    If you're unsure, just take a peek in the source code. That's the beauty of open source projects.