selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🚀 Feature]: Supporting custom capabilities mutators for Grid

Open Purus opened this issue 1 year ago • 11 comments

Feature and motivation

This is similar to the feature proposed in https://github.com/SeleniumHQ/selenium/issues/7478. But it was closed due to lack of user feedback and it was Selenium 3 Grid.

Currently we have an option to provide a custom slot matcher via mode config. Similarly there should be an option to specify custom capabilities mutators via configuration.

SlotMatchrer can only return a boolean after performing custom matching logic and the actual capabilities does not really understand any change.

The above closed issue highlights SessionCapabilitiesMutator but there are no way to provide custom capabilities mutators.

In my use case, when capabilities have certain values I want to update them.

Usage example

As part of mode config, both slot matcher and capabilities mutators can also be specified.

slot-matcher = "com.CustomSlotMatcher"
capabilities-mutator = "com.CustomMutator"

It will help to configure the grid without customising the node just for this feature.

Purus avatar Feb 26 '24 11:02 Purus

@Purus, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] avatar Feb 26 '24 11:02 github-actions[bot]

What is the use case to override that class?

diemol avatar Feb 26 '24 18:02 diemol

The grid gets updated often with new version of browsers.. But the users may have used old capabilities during the test execution.

Instead of failing the request, we would like to enforce the version and update the incoming enrichment to the actual version..

Purus avatar Mar 01 '24 13:03 Purus

So the user would be testing with a different browser instead of the one they requested. I don't think that makes sense.

diemol avatar Mar 01 '24 14:03 diemol

Ok.. let me give some different use case used..

The grid will be updated frequently. Users can use the "browserName" capability as "default" and the grid has to have an option to update the browserName to actual version number( 121 or so).

Currently we have created a new custom node implementation and have made changes to update the capabilities.

If this feature is out of box, it will avoid creating custom node implementation.

On Fri, 1 Mar, 2024, 7:31 pm Diego Molina, @.***> wrote:

So the user would be testing with a different browser instead of the one they requested. I don't think that makes sense.

— Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium/issues/13628#issuecomment-1973259026, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIHDZ33MRWQCAIKT6XV6CDYWCC33AVCNFSM6AAAAABDZ7UOEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZTGI2TSMBSGY . You are receiving this because you were mentioned.Message ID: @.***>

Purus avatar Mar 01 '24 14:03 Purus

I theory, Grid supports stable, and it should match the recent browser release. @titusfortner worked on it.

diemol avatar Mar 04 '24 12:03 diemol

Above use case is just one example and our grid is evolving.

Another use case is enforcing 2 different proxies by updating the capabilities.

It would be good to support such mutations out of box.

On Mon, 4 Mar, 2024, 6:23 pm Diego Molina, @.***> wrote:

I theory, Grid supports stable, and it should match the recent browser release. @titusfortner https://github.com/titusfortner worked on it.

— Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium/issues/13628#issuecomment-1976518615, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIHDZ3PB32IXGUUHPC5GNLYWRVDZAVCNFSM6AAAAABDZ7UOEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZWGUYTQNRRGU . You are receiving this because you were mentioned.Message ID: @.***>

Purus avatar Mar 04 '24 13:03 Purus

Would you like to send a PR for it?

diemol avatar Mar 04 '24 13:03 diemol

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

github-actions[bot] avatar Mar 04 '24 13:03 github-actions[bot]

Yes. I am interested..I will create a PR and would need your support for review.

On Mon, 4 Mar, 2024, 6:32 pm Diego Molina, @.***> wrote:

Would you like to send a PR for it?

— Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium/issues/13628#issuecomment-1976535673, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIHDZ2LI7P5JQLFBUNSTDLYWRWG5AVCNFSM6AAAAABDZ7UOEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZWGUZTKNRXGM . You are receiving this because you were mentioned.Message ID: @.***>

Purus avatar Mar 04 '24 13:03 Purus

@diemol can you please help with the review of the PR? This is my first contribution to selenium.

Purus avatar Mar 10 '24 15:03 Purus