[英]Enforce not using Selenium RC in a grid
I am to provide a Selenium grid and would like to enforce that our developers no longer use the RC API. 我要提供一个Selenium网格,并要强制我们的开发人员不再使用RC API。 From what I learnt RC is deprecated and on the client side you need to import the legacy code: https://seleniumhq.github.io/selenium/docs/api/java/deprecated-list.html
从我了解到的RC已被弃用的方面来看,在客户端上,您需要导入旧版代码: https : //seleniumhq.github.io/selenium/docs/api/java/deprecated-list.html
But what if a developer uses the old RC calls ? 但是,如果开发人员使用旧的RC调用怎么办? I found no way to disable support for RC on the hub.
我发现没有办法在集线器上禁用对RC的支持。 I made my attempts on Selenium 3.4.0
我尝试了硒3.4.0
There is no direct way of doing this. 没有直接的方法可以做到这一点。 But here's a hack of how this can be done.
但是这是如何做到的。
org.openqa.grid.selenium.proxy
org.openqa.grid.selenium.proxy
DefaultRemoteProxy
instead of what is available in the Selenium codebase) DefaultRemoteProxy
版本而不是Selenium代码库中可用的版本) DefaultRemoteProxy
alter its constructor to as shown below. DefaultRemoteProxy
版本中,将其构造函数更改为如下所示。 java -cp
(Feel free to choose whichever option works for you) java -cp
(随意选择适合您的选项) After this, you should be able to prevent people from registering their nodes to your hub wherein the protocol is Selenium RC. 此后,您应该能够阻止人们将其节点注册到协议为Selenium RC的集线器。
public DefaultRemoteProxy(RegistrationRequest request, Registry registry) {
super(request, registry);
for (TestSlot slot : getTestSlots()) {
if (slot.getProtocol() == SeleniumProtocol.Selenium) {
throw new IllegalStateException("Selenium RC Protocol is NOT supported.");
}
}
pollingInterval = config.nodePolling != null ? config.nodePolling : DEFAULT_POLLING_INTERVAL;
unregisterDelay = config.unregisterIfStillDownAfter != null ? config.unregisterIfStillDownAfter : DEFAULT_UNREGISTER_DELAY;
downPollingLimit = config.downPollingLimit != null ? config.downPollingLimit : DEFAULT_DOWN_POLLING_LIMIT;
}
This should help you achieve what you are after. 这应该可以帮助您实现所追求的目标。
The flip side of this is that you would need to make sure you are constantly monitoring the contents of org.openqa.grid.selenium.proxy.DefaultRemoteProxy in the Selenium codebase and keep updating your local version else you may run into a situation wherein things go out of sync. 不利的一面是,您需要确保不断监控Selenium代码库中org.openqa.grid.selenium.proxy.DefaultRemoteProxy的内容,并不断更新本地版本,否则您可能会遇到这种情况不同步。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.