/** * @param executor is an instance of {@link org.openqa.selenium.remote.HttpCommandExecutor} * or class that extends it. Default commands or another vendor-specific * commands may be specified there. * @param capabilities take a look * at {@link org.openqa.selenium.Capabilities} * @param converterClazz is an instance of a class that extends * {@link org.openqa.selenium.remote.internal.JsonToWebElementConverter}. It converts * JSON response to an instance of * {@link org.openqa.selenium.WebElement} */ protected AppiumDriver(HttpCommandExecutor executor, Capabilities capabilities, Class<? extends JsonToWebElementConverter> converterClazz) { super(executor, capabilities); this.executeMethod = new AppiumExecutionMethod(this); locationContext = new RemoteLocationContext(executeMethod); super.setErrorHandler(errorHandler); this.remoteAddress = executor.getAddressOfRemoteServer(); try { Constructor<? extends JsonToWebElementConverter> constructor = converterClazz.getConstructor(RemoteWebDriver.class); this.setElementConverter(constructor.newInstance(this)); } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new RuntimeException(e); } }
public MyChromeDriver(ChromeDriverService service, Capabilities capabilities) { super(new MyChromeDriverCommandExecutor(service), capabilities); this.locationContext = new RemoteLocationContext(this.getExecuteMethod()); this.webStorage = new RemoteWebStorage(this.getExecuteMethod()); this.touchScreen = new RemoteTouchScreen(this.getExecuteMethod()); this.networkConnection = new RemoteNetworkConnection(this.getExecuteMethod()); }
static LocationContext getLocationContext(WebDriver driver) { return convert(driver, LocationContext.class, CapabilityType.SUPPORTS_LOCATION_CONTEXT, RemoteLocationContext.class); }