[java][BiDi] implement emulation.setScriptingEnabled - #16631
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||||
|
Check comments by the AI bot, these makes sense:
But for 3rd one, we should have this: public class SetScriptingEnabledParameters extends AbstractOverrideParameters {
public SetScriptingEnabledParameters(Boolean enabled) {
if (enabled == Boolean.TRUE) {
throw new IllegalArgumentException(
"Only emulation of disabled JavaScript is supported (enabled must be false or null)");
}
map.put("enabled", enabled); // null or false
}
} |
|
@Delta456 After setting "js enabled = false", how can I reset it back? |
You need to use |
|
I don't see the word "None" in the PR. :) I see only these two variants:
So when I want "true", I have to write "null" instead of "true". Is it logical? Why can't we allow users write "true"? |
|
Ah yes, now I see it. W3C spec allows only false or null. This is a very strange spec IMHO. :) |

User description
🔗 Related Issues
💥 What does this PR do?
Implements https://w3c.github.io/webdriver-bidi/#command-emulation-setScriptingEnabled for Java
🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement
Description
Implements BiDi
emulation.setScriptingEnabledcommand for JavaAdds
SetScriptingEnabledParametersclass with validation logicIncludes comprehensive tests for contexts and user contexts
Adds test HTML page for script execution verification
Diagram Walkthrough
File Walkthrough
Emulation.java
Add setScriptingEnabled method to Emulationjava/src/org/openqa/selenium/bidi/emulation/Emulation.java
setScriptingEnabled()method to Emulation classemulation.setScriptingEnabledwith parametersSetScriptingEnabledParameters.java
New SetScriptingEnabledParameters class with validationjava/src/org/openqa/selenium/bidi/emulation/SetScriptingEnabledParameters.java
AbstractOverrideParametersenabledparameter is false or null onlycontexts()anduserContexts()fluent methodsIllegalArgumentExceptionif enabled is trueSetScriptingEnabledTest.java
Comprehensive tests for setScriptingEnabled functionalityjava/test/org/openqa/selenium/bidi/emulation/SetScriptingEnabledTest.java
setScriptingEnabledwith contexts parametersetScriptingEnabledwith user contexts parameterscript_page.html
Test page for script execution verificationcommon/src/web/script_page.html