Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

A way to prevent window.callPhantom from existing #12860

Closed
chris-martin opened this issue Jan 5, 2015 · 4 comments
Closed

A way to prevent window.callPhantom from existing #12860

chris-martin opened this issue Jan 5, 2015 · 4 comments
Labels

Comments

@chris-martin
Copy link

Could we have a setting to turn this feature off? I'd like Phantom to behave the same as other browsers, to the greatest extent possible.

There was a related mailing list discussion a few years ago but it doesn't seem like the subject was ever revisited.

Being able to customize the name of this variable instead of hard-coding it to callPhantom would also be a fine workaround (for my case, at least).

@JamesMGreene
Copy link
Collaborator

If you aren't utilizing window.callPhantom yourself, you should just be able to remove it from the window object altogether IIRC, e.g.

page.onInitialized = function() {
  page.evaluate(function() {
    delete window.callPhantom;
  });
};

@chris-martin
Copy link
Author

Does onInitialized necessarily run before any scripts that are on the page?

Can I do this if I'm using Phantom via Selenium?

@JamesMGreene
Copy link
Collaborator

Does onInitialized necessarily run before any scripts that are on the page?

If there are script tags in the page's HTML, yes, the onInitialized callback will be invoked immediately before the first page script is evaluated.

If there are NOT script tags in the page's HTML, then the onInitialized callback will not be invoked at all (see Issues #10772, #12387)... unless [apparently] you then probe the page with Phantom-based script injections like page.evaluate (see Issue #11684).

Also, please note that this setup will not cover your bases [currently] for framed pages (iframe, frameset, etc.) AFAIK (see Issue #10608).

Can I do this if I'm using Phantom via Selenium?

No idea, I have never used Phantom via Selenium before. Sorry!

@stale stale bot added the stale label Dec 26, 2019
@stale
Copy link

stale bot commented Dec 29, 2019

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants