From c3a4a4b231e98d2bf3ecc6824a539105b0627912 Mon Sep 17 00:00:00 2001 From: Simon Stewart Date: Thu, 1 Nov 2018 16:59:40 +0000 Subject: [PATCH] Remove deprecated AugmenterProviders --- .../openqa/selenium/remote/AddFindsByCss.java | 49 ------------------ .../selenium/remote/AddFindsChildByCss.java | 51 ------------------- .../selenium/remote/AddRemoteTouchScreen.java | 40 --------------- .../src/org/openqa/selenium/remote/BUCK | 3 -- .../openqa/selenium/remote/BaseAugmenter.java | 19 ++----- .../openqa/selenium/remote/AugmenterTest.java | 2 +- 6 files changed, 6 insertions(+), 158 deletions(-) delete mode 100644 java/client/src/org/openqa/selenium/remote/AddFindsByCss.java delete mode 100644 java/client/src/org/openqa/selenium/remote/AddFindsChildByCss.java delete mode 100644 java/client/src/org/openqa/selenium/remote/AddRemoteTouchScreen.java diff --git a/java/client/src/org/openqa/selenium/remote/AddFindsByCss.java b/java/client/src/org/openqa/selenium/remote/AddFindsByCss.java deleted file mode 100644 index 6949710301e92..0000000000000 --- a/java/client/src/org/openqa/selenium/remote/AddFindsByCss.java +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to the Software Freedom Conservancy (SFC) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The SFC licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.openqa.selenium.remote; - -import com.google.common.collect.ImmutableMap; - -import org.openqa.selenium.WebDriverException; -import org.openqa.selenium.internal.FindsByCssSelector; - -import java.util.Map; - -/** - * @deprecated Everything now finds by css - */ -@Deprecated -public class AddFindsByCss implements AugmenterProvider { - public Class getDescribedInterface() { - return FindsByCssSelector.class; - } - - public InterfaceImplementation getImplementation(Object value) { - return (executeMethod, self, method, args) -> { - Map commandArgs = ImmutableMap.of("using", "css selector", "value", args[0]); - - if ("findElementByCssSelector".equals(method.getName())) { - return executeMethod.execute(DriverCommand.FIND_ELEMENT, commandArgs); - } else if ("findElementsByCssSelector".equals(method.getName())) { - return executeMethod.execute(DriverCommand.FIND_ELEMENTS, commandArgs); - } - - throw new WebDriverException("Unmapped method: " + method.getName()); - }; - } -} diff --git a/java/client/src/org/openqa/selenium/remote/AddFindsChildByCss.java b/java/client/src/org/openqa/selenium/remote/AddFindsChildByCss.java deleted file mode 100644 index e922f1f0220de..0000000000000 --- a/java/client/src/org/openqa/selenium/remote/AddFindsChildByCss.java +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the Software Freedom Conservancy (SFC) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The SFC licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.openqa.selenium.remote; - -import com.google.common.collect.ImmutableMap; - -import org.openqa.selenium.WebDriverException; -import org.openqa.selenium.internal.FindsByCssSelector; - -import java.util.Map; - -/** - * @deprecated Everything now finds by css - */ -@Deprecated -public class AddFindsChildByCss implements AugmenterProvider { - public Class getDescribedInterface() { - return FindsByCssSelector.class; - } - - public InterfaceImplementation getImplementation(Object value) { - return (executeMethod, self, method, args) -> { - Object id = ((RemoteWebElement) self).getId(); - Map commandArgs = - ImmutableMap.of("id", id, "using", "css selector", "value", args[0]); - - if ("findElementByCssSelector".equals(method.getName())) { - return executeMethod.execute(DriverCommand.FIND_ELEMENT, commandArgs); - } else if ("findElementsByCssSelector".equals(method.getName())) { - return executeMethod.execute(DriverCommand.FIND_ELEMENTS, commandArgs); - } - - throw new WebDriverException("Unmapped method: " + method.getName()); - }; - } -} diff --git a/java/client/src/org/openqa/selenium/remote/AddRemoteTouchScreen.java b/java/client/src/org/openqa/selenium/remote/AddRemoteTouchScreen.java deleted file mode 100644 index 04fb373170e48..0000000000000 --- a/java/client/src/org/openqa/selenium/remote/AddRemoteTouchScreen.java +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the Software Freedom Conservancy (SFC) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The SFC licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package org.openqa.selenium.remote; - -import org.openqa.selenium.interactions.HasTouchScreen; - -/** - * Provides the RemoteTouchScreen for getTouch method to the proxy. - * - * @deprecated {@link org.openqa.selenium.interactions.TouchScreen} is deprecated. - */ -@Deprecated -public class AddRemoteTouchScreen implements AugmenterProvider { - - @Override - public Class getDescribedInterface() { - return HasTouchScreen.class; - } - - @Override - public InterfaceImplementation getImplementation(Object value) { - return (executeMethod, self, method, args) -> - "getTouch".equals(method.getName()) ? new RemoteTouchScreen(executeMethod) : null; - } -} diff --git a/java/client/src/org/openqa/selenium/remote/BUCK b/java/client/src/org/openqa/selenium/remote/BUCK index 67156e2294f2f..61e11dfefc6e7 100644 --- a/java/client/src/org/openqa/selenium/remote/BUCK +++ b/java/client/src/org/openqa/selenium/remote/BUCK @@ -49,9 +49,6 @@ java_library(name = 'remote', srcs = [ 'Augmenter.java', 'AugmenterProvider.java', - 'AddFindsByCss.java', - 'AddFindsChildByCss.java', - 'AddRemoteTouchScreen.java', 'AddRotatable.java', 'BaseAugmenter.java', 'InterfaceImplementation.java', diff --git a/java/client/src/org/openqa/selenium/remote/BaseAugmenter.java b/java/client/src/org/openqa/selenium/remote/BaseAugmenter.java index fa88337c49d40..d348a2645e07a 100644 --- a/java/client/src/org/openqa/selenium/remote/BaseAugmenter.java +++ b/java/client/src/org/openqa/selenium/remote/BaseAugmenter.java @@ -25,6 +25,7 @@ import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_NETWORK_CONNECTION; import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_WEB_STORAGE; +import org.openqa.selenium.Beta; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.html5.AddApplicationCache; @@ -47,24 +48,17 @@ public abstract class BaseAugmenter { private final Map elementAugmentors = new HashMap<>(); public BaseAugmenter() { - addDriverAugmentation(SUPPORTS_FINDING_BY_CSS, new AddFindsByCss()); addDriverAugmentation(SUPPORTS_LOCATION_CONTEXT, new AddLocationContext()); addDriverAugmentation(SUPPORTS_APPLICATION_CACHE, new AddApplicationCache()); addDriverAugmentation(SUPPORTS_NETWORK_CONNECTION, new AddNetworkConnection()); addDriverAugmentation(SUPPORTS_WEB_STORAGE, new AddWebStorage()); addDriverAugmentation(ROTATABLE, new AddRotatable()); - addDriverAugmentation(HAS_TOUCHSCREEN, new AddRemoteTouchScreen()); - - addElementAugmentation(SUPPORTS_FINDING_BY_CSS, new AddFindsChildByCss()); } /** * Add a mapping between a capability name and the implementation of the interface that name - * represents for instances of {@link org.openqa.selenium.WebDriver}. For example (@link - * CapabilityType#SUPPORTS_FINDING_BY_CSS} represents the interface - * {@link org.openqa.selenium.internal.FindsByCssSelector}, which is implemented via the - * {@link org.openqa.selenium.remote.AddFindsByCss} provider. - * + * represents for instances of {@link org.openqa.selenium.WebDriver}. + *

* Note: This method is still experimental. Use at your own risk. * * @param capabilityName The name of the capability to model @@ -76,11 +70,8 @@ public void addDriverAugmentation(String capabilityName, AugmenterProvider handl /** * Add a mapping between a capability name and the implementation of the interface that name - * represents for instances of {@link org.openqa.selenium.WebElement}. For example (@link - * CapabilityType#SUPPORTS_FINDING_BY_CSS} represents the interface - * {@link org.openqa.selenium.internal.FindsByCssSelector}, which is implemented via the - * {@link AddFindsByCss} provider. - * + * represents for instances of {@link org.openqa.selenium.WebElement}. + *

* Note: This method is still experimental. Use at your own risk. * * @param capabilityName The name of the capability to model diff --git a/java/client/test/org/openqa/selenium/remote/AugmenterTest.java b/java/client/test/org/openqa/selenium/remote/AugmenterTest.java index 58d7e7316e2e2..6b7ce641858c3 100644 --- a/java/client/test/org/openqa/selenium/remote/AugmenterTest.java +++ b/java/client/test/org/openqa/selenium/remote/AugmenterTest.java @@ -122,7 +122,7 @@ public void shouldNotAugmentRemoteWebDriverWithoutExtraCapabilities() { @Test public void shouldAugmentRemoteWebDriverWithExtraCapabilities() { - Capabilities caps = new ImmutableCapabilities(CapabilityType.SUPPORTS_FINDING_BY_CSS, true); + Capabilities caps = new ImmutableCapabilities(CapabilityType.SUPPORTS_WEB_STORAGE, true); StubExecutor stubExecutor = new StubExecutor(caps); WebDriver driver = new RemoteWebDriver(stubExecutor, caps);