How to replace a capability-value in the Selenium Grid before passing to a node
Asked Answered
W

1

18

Can a Selenium Grid change the DesiredCaps of the SeleniumClient?

Is their a way to change the values of the Capabilities in the Selenium Grid?

I am already extending the org.openqa.grid.internal.utils.DefaultCapabilityMatcher in a java class to validate some values. Need a way to replace them as well before passing to the Nodes?

Wulfe answered 17/9, 2015 at 8:3 Comment(6)
Even if such a way exists, you will allocate a Chrome v30 to a client which requested Chrome v26. Doesnt that break the contract?Catchup
Ummm, that is not exactly the usecase. Actually the user would ask for a "browser code" like give me b2831. Now the hub should replace the b2831 with Google Chrome v31Wulfe
In that case you will be having a mapping, right?Slag
@Shubhasmit Yes, i will have a Mapping, but only on the Machine where SeleniumGrid is present.Wulfe
hub can not do that on it's own, you have to build a logic to do that.Slag
Not sure this is even a valid question. Sure: the Grid has default values. BUT: every session thread you start first begins with its own Capabilities object that is part of the RemoteWebDriver instance , which I assume overrides the Node defaults? Of course the node that is selected by the grid will match the browser name and version you selected but I would guess that the other capabilities should override any of the other default options.Viviennevivify
C
1

You can build your on custom proxy to do so. In the custom proxy you need to extend the following class: org.openqa.grid.selenium.proxy.DefaultRemoteProxy and override beforeSession function which has TestSession object as a parameter, from where you can get the capabilities. While registering your node you need to specify the new proxy and start the hub with new custom proxy.

Canasta answered 8/1, 2016 at 12:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.