-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[java] Add "se" prefixed capabilities to session response #14323
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
Conversation
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought #14316 was caused by the caps merge in ChromiumOptions, because it works well in Firefox.
So Firefox returns any caps it does not recognize as part of session creation response. But Chromium based browsers filter it out. Hence the difference in behavior. The merge works as expected ( I debugged through it). So this capability needs to be added in the response, similar to what we do for devtools. |
Understood. Thank you for explaining this. Should we make this more generic and return all prefixed capabilities? |
@VietND96 Also suggested to make it generic. My concern was the "se:" notation is used by cloud providers too. So not sure if adding all such capabilities in the response with that notation is the best approach. What do you think? |
I know it is used to overwrite the value of |
I understand. So it is okay to add the options that cloud providers send back in the response? Then we can do this. |
I would say so. We can always iterate on it. |
How the complexity for that generic implementation? Can it be delivered in version 4.24? |
I will go add the support to return all prefixed capabilities. |
56acc01
to
1ef9ba5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @pujagani!
@pujagani , I have checked the Nightly build, but the result didn't meet expectation. Below is response from GraphQL for stereotype and session capabilities. {
"data": {
"session": {
"id": "fee9aa7d5b9bfed8215dc4c13eb712e8",
"capabilities": "{\n \"acceptInsecureCerts\": false,\n \"browserName\": \"chrome\",\n \"browserVersion\": \"127.0.6533.119\",\n \"chrome\": {\n \"chromedriverVersion\": \"127.0.6533.119 (bdef6783a05f0b3f885591e7d2c7b2aec1a89dea-refs\\u002fbranch-heads\\u002f6533@{#1999})\",\n \"userDataDir\": \"\\u002ftmp\\u002f.org.chromium.Chromium.ayWmnw\"\n },\n \"fedcm:accounts\": true,\n \"goog:chromeOptions\": {\n \"debuggerAddress\": \"localhost:46525\"\n },\n \"networkConnectionEnabled\": false,\n \"pageLoadStrategy\": \"normal\",\n \"platformName\": \"linux\",\n \"proxy\": {\n },\n \"se:bidiEnabled\": false,\n \"se:cdp\": \"wss:\\u002f\\u002f10.1.0.245\\u002fselenium\\u002fsession\\u002ffee9aa7d5b9bfed8215dc4c13eb712e8\\u002fse\\u002fcdp\",\n \"se:cdpVersion\": \"127.0.6533.119\",\n \"se:downloadsEnabled\": true,\n \"se:name\": \"test_play_video (ChromeTests)\",\n \"se:recordVideo\": true,\n \"se:screenResolution\": \"1920x1080\",\n \"se:vnc\": \"wss:\\u002f\\u002f10.1.0.245\\u002fselenium\\u002fsession\\u002ffee9aa7d5b9bfed8215dc4c13eb712e8\\u002fse\\u002fvnc\",\n \"se:vncEnabled\": true,\n \"se:vncLocalAddress\": \"ws:\\u002f\\u002f10.244.251.137:7900\",\n \"setWindowRect\": true,\n \"strictFileInteractability\": false,\n \"timeouts\": {\n \"implicit\": 0,\n \"pageLoad\": 300000,\n \"script\": 30000\n },\n \"unhandledPromptBehavior\": \"dismiss and notify\",\n \"webauthn:extension:credBlob\": true,\n \"webauthn:extension:largeBlob\": true,\n \"webauthn:extension:minPinLength\": true,\n \"webauthn:extension:prf\": true,\n \"webauthn:virtualAuthenticators\": true\n}",
"startTime": "21/08/2024 01:45:57",
"uri": "http://10.244.251.137:6666",
"nodeId": "b1f84412-a065-472d-8a83-c0eba6de300b",
"nodeUri": "http://10.244.251.137:6666",
"sessionDurationMillis": "1016",
"slot": {
"id": "62afd8fb-a123-4497-b475-8c0c383ff6c5",
"stereotype": "{\n \"browserName\": \"chrome\",\n \"browserVersion\": \"127.0\",\n \"goog:chromeOptions\": {\n \"binary\": \"\\u002fusr\\u002fbin\\u002fchromium\"\n },\n \"platformName\": \"linux\",\n \"se:containerName\": \"my-chrome-name-85c6f9fb-tmcqf\",\n \"se:downloadsEnabled\": true,\n \"se:noVncPort\": 7900,\n \"se:vncEnabled\": true\n}",
"lastStarted": "21/08/2024 01:45:57"
}
}
}
} |
Which graphQL endpoint are you calling? |
@pujagani, the endpoint is selenium-hub:4444/graphql with query as below
|
In Hub logs, it printed caps as below,
|
Thank you for checking. Let me triage this further. |
requestedCapsMap.forEach( | ||
(k, v) -> { | ||
if (k.startsWith("se:") && !returnedCapsMap.containsKey(k)) { | ||
returnPrefixedCaps.setCapability(k, v); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the issue is that setCapability
returns a new PersistentCapabilities
object and does not modify the current one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly. I fixed it via ef1b422.
It was a quick fix, but how to add a test for it is tricky. We don't have an end-to-end test for DriverServiceSessionFactory.
|
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Fixes #14316.
Motivation and Context
Types of changes
Checklist
PR Type
Enhancement, Tests
Description
readContainerName
inDriverServiceSessionFactory
to read and set these:containerName
capability.readContainerName
method into the session creation process to ensure the capability is included in the session response.responseCapsShowContainerName
inLocalNodeTest
to verify that these:containerName
capability is correctly included in the session response.Changes walkthrough 📝
DriverServiceSessionFactory.java
Add method to read and set `se:containerName` capability
java/src/org/openqa/selenium/grid/node/config/DriverServiceSessionFactory.java
readContainerName
to read and set these:containerName
capability.
readContainerName
method into the session creation process.LocalNodeTest.java
Add test for `se:containerName` capability in session response
java/test/org/openqa/selenium/grid/node/local/LocalNodeTest.java
responseCapsShowContainerName
to verify these:containerName
capability in session response.