-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to disable JavaScript for a browsing context #746
Comments
Yes, I think this makes sense. I'm not 100% sure if Gecko can disable it per (top level) navigable, but in any case it would make sense to have a command that either allowed disabling globally or for certain top-level navigables. |
The BrowsingContext webidl has a |
What should happen when JS is disabled yet a session wants to evaluate some JS? I believe that should still work, but it's best to confirm |
@shs96c yeah, that should still work: only the scripts coming from the page should not be executed as if JS is not supported. |
For info that's what we use for FF DevTools' "Disable JavaScript" feature |
The CDP method is |
The Browser Testing and Tools Working Group just discussed The full IRC log of that discussion<simonstewart> Topic: Ability to disable JavaScript<simonstewart> github: https://github.com//issues/746 <simonstewart> jgraham: Apparently people want to test without JS enabled. The idea would be to disable JS for a specific top-level traversable, or perhaps navigable (though the former makes more sense than the latter) <simonstewart> jgraham: Seems to be very easy to implement in Gecko. Is already implemented in CDP. <simonstewart> jgraham: What should happen if the session wants to evaluate some JS. <simonstewart> gsnedders: the WebKit answer is that you can't <simonstewart> jgraham: In gecko, you can execute in a sandbox, but not in content <gsnedders> s/you can't/you can't I think/ <simonstewart> simonstewart: people will disable JS, and then the next thing they'll do is try to evaluate some JS (either directly or through a library function) <simonstewart> jgraham: this feature only really makes sense if you can continue to execute other scripts. <simonstewart> jgraham: without that, every other command you try and execute, everything else would fall apart <simonstewart> jgraham: allowing scripts in a sandbox would be implementable. <simonstewart> simonstewart: for interop between selenium and pages under test, people tend to want to operate on the content <simonstewart> jimevans: the thing about running with JS disabled is that the people who want to run with JS disabled, really don't want JS at all <simonstewart> jimevans: they want to ensure that the pages under test continue to work without JS at all <simonstewart> jimevans: you can still do a lot with HTML and CSS, eg. using forms to send data to a backend. <simonstewart> jgraham: having a command that sets a flag (as shown in the issue) seems like a quick thing to implement. The question about what to do once JS is disabled is a hard one to answer. <simonstewart> jgraham: implementations may choose to pre-emptively fail the execute script command if JS is disabled, or want to return unsupported command if the browser doesn't support disabling JS |
Note that Chrome still allows script evaluation via CDP if JS is disabled for the page and clients like Puppeteer expect this (test). |
Chrome allows disabling JavaScript for a specific page: https://pptr.dev/api/puppeteer.page.setjavascriptenabled/
Does it make sense to have this functionality in WebDriver BiDi?
The text was updated successfully, but these errors were encountered: