Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8466111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:14:45+00:00 2026-06-10T15:14:45+00:00

I am using PhantomJS to create screenshots from arbitrary URLs. Before the screenshot is

  • 0

I am using PhantomJS to create screenshots from arbitrary URLs. Before the screenshot is taken, I want to manipulate the page DOM to remove all drop-down menus, as PhantomJS renders them incorrectly in the top left-hand corner of the page (a known Phantom issue.)

I have a simple DOM script to do this with:

    var selects = document.getElementsByTagName('select');

    for (var i=0; i < selects.length; i++) {
        document.getElementsByTagName('select')[i].style.visibility="hidden";
    }

This has been tested and works fine as stand-alone Javascript. It doesn’t however work inside the PhantomJS code I am using to collect the screenshots (last part shown):

  page.open(address, function (status) {

    if (status !== 'success') {
        console.log('Unable to load the address!');
    } else {
        window.setTimeout(function () {

            var selects = document.getElementsByTagName('select');

            for (var i=0; i < selects.length; i++) {
                document.getElementsByTagName('select')[i].style.visibility="hidden";
            }

            page.render(output);

            phantom.exit();

        }, 200);
    }
});

Some pages are still rendering with a select box in the wrong place. I’d appreciate help either solving the original PhantomJS rendering bug or hiding the drop-down menus in the DOM. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:14:47+00:00Added an answer on June 10, 2026 at 3:14 pm

    Run it in the right context, i.e. inside the page with page.evaluate. There are many examples included with PhantomJS which demonstrate this, e.g. useragent.js.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know it's possible to arbitrarily crop a screenshot in PhantomJS, using page.clipRect() :
I'm using PhantomJS page.evaluate() to do some scraping. My problem is that the code
I have a PhantomJS/CasperJS script which I'm running from within a node.js script using
I trying to run my jamsine specs from command line using PhantomJs.exe. Here is
I finally succeeded in using Ajax to get SOMETHING sent from one page to
Using a populated Table Type as the source for a TSQL-Merge. I want to
I'm using PhantomJS with jQuery and I'm wondering if it's possible to capture an
I have a few pure-JavaScript, client-side tests using PhantomJS. These I'd like to integrate
I am trying to write a program using the lynx command on this page
I am trying to use PhantomJS on a page with basic always auth, for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.