[英]Enforce not using Selenium RC in a grid
我要提供一个Selenium网格,并要强制我们的开发人员不再使用RC API。 从我了解到的RC已被弃用的方面来看,在客户端上,您需要导入旧版代码: https : //seleniumhq.github.io/selenium/docs/api/java/deprecated-list.html
但是,如果开发人员使用旧的RC调用怎么办? 我发现没有办法在集线器上禁用对RC的支持。 我尝试了硒3.4.0
没有直接的方法可以做到这一点。 但是这是如何做到的。
org.openqa.grid.selenium.proxy
DefaultRemoteProxy
版本而不是Selenium代码库中可用的版本) DefaultRemoteProxy
版本中,将其构造函数更改为如下所示。 java -cp
(随意选择适合您的选项) 此后,您应该能够阻止人们将其节点注册到协议为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;
}
这应该可以帮助您实现所追求的目标。
不利的一面是,您需要确保不断监控Selenium代码库中org.openqa.grid.selenium.proxy.DefaultRemoteProxy的内容,并不断更新本地版本,否则您可能会遇到这种情况不同步。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.