Я пытаюсь настроить сопоставление пользовательских возможностей с использованием сетки Selenium.Версия Selenium Server: 3.141.59
Ниже мой код:
import org.openqa.grid.internal.utils.DefaultCapabilityMatcher;
import java.util.Map;
public class YtlcCapabilityMatcher extends DefaultCapabilityMatcher {
private final String deviceName = "deviceName";
@Override
public boolean matches(Map nodeCapability, Map requestedCapability) {
boolean basicChecks = super.matches(nodeCapability, requestedCapability);
if (! requestedCapability.containsKey(deviceName)){
//If the user didnt set the custom capability lets just return what the DefaultCapabilityMatcher
//would return. That way we are backward compatibility and arent breaking the default behavior of the
//grid
return basicChecks;
}
return (basicChecks && nodeCapability.get(deviceName).equals(requestedCapability.get(deviceName)));
}
Это мой JSON-файл конфигурации:
{
"host": "10.28.19.251",
"port": 4545,
"servlets" : [],
"prioritizer": null,
"capabilityMatcher": "com.ytlctest.capability.YtlcCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 5000,
"cleanUpCycle": 5000,
"timeout": 30000,
"browserTimeout": 120,
"timeout": 120,
"newSessionWaitTimeout": 120,
"maxSession": 1000,
"jettyMaxThreads":-1
}
Я получаю следующую ошибку:
Исключение в потоке "main" org.openqa.grid.common.exception.GridConfigurationException: com.ytlctest.capability.YtlcCapabilityMatcher.class не может быть приведено к экземпляру. Информация о сборке: версия: '3.141.59 ', редакция:' e82be7d358 ', время:' 2018-11-14T08: 25: 53 'Системная информация: хост:' SN2YCVW1B0005 ', IP-адрес: '10 .10.1.251', имя os.name: 'Windows 8.1', o s.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_212' Информация о драйвере: driver.version: неизвестно в org.openqa.grid.internal.utils.configuration.json.CommonJsonConfiguration.fromJson (CommonJsonConfiguration.java:52) в org.openqa.grid.internal.utils.configuration.json.CommonJsonConfiguration.f.frResourceOrFile (CommonJsonConfiguration.java:41) в org.openqa.grid.internal.utils.confubtioJjign.loadFromResourceOrFile (HubJsonConfiguration.java: 41) в java.util.Optional.map (неизвестный источник) в org.openqa.grid.internal.utils.configuration.GridHubConfiguration. (GridHubConfiguration.java:106) в org.openqa.grid.selenium.GridLauncherV3.lambda$ buildLaunchers $ 5 (GridL auncherV3.java:259) в org.openqa.grid.selenium.GridLauncherV3.lambda $ launch $ 0 (GridLauncherV 3.java:86) в java.util.Optional.map (Неизвестный источник) в org.openqa.grid.selenium.GridLauncherV3.launch (GridLauncherV3.java:86) в org.openqa.grid.selenium.GridLauncherV3.main (GridLauncherV3.java:70) Причина: org.openqa.selenium.json.JsonException: com.y..capability.YtlcC apabilityMatcher.class не удалось привести к экземпляру Информация о сборке: версия: '3.141.59', ревизия: 'e82be7d358', время: '2018-11-14T08: 25: 53' Информация о системе: хост: 'SN2YCVW1B0005', ip: '10 .10.1.251', os.name: 'Windows 8.1', o s.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_212' Информация о драйвере: драйвер.версия: неизвестна в org.openqa.grid.common.GridConfiguredJson $ SimpleClassNameCoercer.lamb da $ apply $ 0 (GridConfiguredJson.java:79) в org.openqa.selenium.json.JsonTypeCoercer.lambda $ null $ 6 (JsonTypeCoerce r.java:145) в org.openqa.selenium.json.JsonTypeCoerer) в org.openqa.selenium.json.InstanceCoercer.lambda $ применить $ 0 (InstanceCoerc er.java:87) в org.openqa.selenium.json.JsonTypeCoercer.lambda $ ноль $ 6 (JsonTypeCoerce r.java1: 45)openqa.selenium.json.JsonTypeCoercer.coerce (JsonTypeCoercer.java: 126) в org.openqa.selenium.json.JsonInput.read (JsonInput.java:280) в org.openqa.grid.common.GridConfigureDpetoJson.j ava: 56) at org.openqa.grid.internal.utils.configuration.json.CommonJsonConfiguration.fromJson (CommonJsonConfiguration.java:48) ... еще 9
Я разместил компиляциюФайл класса в "com / ytlctest /ability".
Пожалуйста, помогите!