[英]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.