Skip to content

Commit

Permalink
[java] Deprecating non W3C caps and Augmenters using them
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol committed May 25, 2022
1 parent 69f6a3f commit 348f17b
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 17 deletions.
9 changes: 6 additions & 3 deletions java/src/org/openqa/selenium/Rotatable.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
package org.openqa.selenium;

/**
* @deprecated As this is only available only for mobile which is handled by the Appium project
*
* Represents rotation of the browser view for orientation-sensitive devices.
*
* When using this with a real device, the device should not be moved so that the built-in sensors
* do not interfere.
*/
@Deprecated
public interface Rotatable {

/**
Expand All @@ -36,15 +39,15 @@ public interface Rotatable {
* @return the current screen orientation of the browser
*/
ScreenOrientation getOrientation();

/**
* Changes the rotation of the browser window.
*/
void rotate(DeviceRotation rotation);

/**
* @return DeviceOrientation describing the current screen rotation of the browser window
*/
DeviceRotation rotation();

}
4 changes: 4 additions & 0 deletions java/src/org/openqa/selenium/remote/AddRotatable.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

import static org.openqa.selenium.remote.CapabilityType.ROTATABLE;

/**
* @deprecated Uses a non W3C compliant capability and is not available in W3C WebDriver sessions
*/
@Deprecated
public class AddRotatable implements AugmenterProvider<Rotatable> {

@Override
Expand Down
119 changes: 111 additions & 8 deletions java/src/org/openqa/selenium/remote/CapabilityType.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,53 +22,156 @@
*/
public interface CapabilityType {

String BROWSER_NAME = "browserName";
/**
* @deprecated Use {@link CapabilityType#PLATFORM_NAME}
*/
@Deprecated
String PLATFORM = "platform";
String PLATFORM_NAME = "platformName";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String SUPPORTS_JAVASCRIPT = "javascriptEnabled";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String TAKES_SCREENSHOT = "takesScreenshot";
/**
* @deprecated Use {@link CapabilityType#BROWSER_VERSION}
*/
@Deprecated
String VERSION = "version";
String BROWSER_VERSION = "browserVersion";
/**
* @deprecated Use {@link CapabilityType#UNHANDLED_PROMPT_BEHAVIOUR}
*/
@Deprecated
String SUPPORTS_ALERTS = "handlesAlerts";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String SUPPORTS_SQL_DATABASE = "databaseEnabled";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String SUPPORTS_LOCATION_CONTEXT = "locationContextEnabled";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String SUPPORTS_APPLICATION_CACHE = "applicationCacheEnabled";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String SUPPORTS_NETWORK_CONNECTION = "networkConnectionEnabled";
String PROXY = "proxy";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String SUPPORTS_WEB_STORAGE = "webStorageEnabled";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String ROTATABLE = "rotatable";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String APPLICATION_NAME = "applicationName";
// Enable this capability to accept all SSL certs by defaults.
/**
* @deprecated Use {@link CapabilityType#ACCEPT_INSECURE_CERTS}
*/
@Deprecated
String ACCEPT_SSL_CERTS = "acceptSslCerts";
String ACCEPT_INSECURE_CERTS = "acceptInsecureCerts";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String HAS_NATIVE_EVENTS = "nativeEvents";
/**
* @deprecated Use {@link CapabilityType#UNHANDLED_PROMPT_BEHAVIOUR}
*/
@Deprecated
String UNEXPECTED_ALERT_BEHAVIOUR = "unexpectedAlertBehaviour";
String UNHANDLED_PROMPT_BEHAVIOUR = "unhandledPromptBehavior";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String ELEMENT_SCROLL_BEHAVIOR = "elementScrollBehavior";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String HAS_TOUCHSCREEN = "hasTouchScreen";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String OVERLAPPING_CHECK_DISABLED = "overlappingCheckDisabled";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String STRICT_FILE_INTERACTABILITY = "strictFileInteractability";
String TIMEOUTS = "timeouts";

/**
* @deprecated Non W3C compliant
*/
@Deprecated
String LOGGING_PREFS = "loggingPrefs";

/**
* @deprecated Non W3C compliant
*/
@Deprecated
String ENABLE_PROFILING_CAPABILITY = "webdriver.logging.profiler.enabled";


String BROWSER_NAME = "browserName";
String PLATFORM_NAME = "platformName";
String BROWSER_VERSION = "browserVersion";
String ACCEPT_INSECURE_CERTS = "acceptInsecureCerts";
String PAGE_LOAD_STRATEGY = "pageLoadStrategy";
String PROXY = "proxy";
String SET_WINDOW_RECT = "setWindowRect";
String TIMEOUTS = "timeouts";
String UNHANDLED_PROMPT_BEHAVIOUR = "unhandledPromptBehavior";


/**
* @deprecated Non W3C compliant
*/
@Deprecated
interface ForSeleniumServer {

/**
* @deprecated Non W3C compliant
*/
@Deprecated
String AVOIDING_PROXY = "avoidProxy";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String ONLY_PROXYING_SELENIUM_TRAFFIC = "onlyProxySeleniumTraffic";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String PROXYING_EVERYTHING = "proxyEverything";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String PROXY_PAC = "proxy_pac";
/**
* @deprecated Non W3C compliant
*/
@Deprecated
String ENSURING_CLEAN_SESSION = "ensureCleanSession";
}
}
16 changes: 10 additions & 6 deletions java/src/org/openqa/selenium/remote/DesiredCapabilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@

package org.openqa.selenium.remote;

import static org.openqa.selenium.remote.CapabilityType.ACCEPT_INSECURE_CERTS;
import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME;
import static org.openqa.selenium.remote.CapabilityType.PLATFORM;
import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_JAVASCRIPT;
import static org.openqa.selenium.remote.CapabilityType.VERSION;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.MutableCapabilities;
import org.openqa.selenium.Platform;

import java.util.Map;

import static org.openqa.selenium.remote.CapabilityType.ACCEPT_INSECURE_CERTS;
import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME;
import static org.openqa.selenium.remote.CapabilityType.PLATFORM;
import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_JAVASCRIPT;
import static org.openqa.selenium.remote.CapabilityType.VERSION;

public class DesiredCapabilities extends MutableCapabilities {

public DesiredCapabilities(String browser, String version, Platform platform) {
Expand Down Expand Up @@ -71,6 +71,10 @@ public void setPlatform(Platform platform) {
setCapability(PLATFORM, platform);
}

/**
* @deprecated This setting has no effect in W3C sessions, and JWP support is going away soon.
*/
@Deprecated
public void setJavascriptEnabled(boolean javascriptEnabled) {
setCapability(SUPPORTS_JAVASCRIPT, javascriptEnabled);
}
Expand Down
5 changes: 5 additions & 0 deletions java/src/org/openqa/selenium/remote/RemoteRotatable.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@
package org.openqa.selenium.remote;

import com.google.common.collect.ImmutableMap;

import org.openqa.selenium.DeviceRotation;
import org.openqa.selenium.Rotatable;
import org.openqa.selenium.ScreenOrientation;
import org.openqa.selenium.internal.Require;

import java.util.Map;

/**
* @deprecated As this is only available only for mobile which is handled by the Appium project
*/
@Deprecated
class RemoteRotatable implements Rotatable {

private final ExecuteMethod executeMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_APPLICATION_CACHE;

/**
* @deprecated Uses a non W3C compliant capability and is not available in W3C WebDriver sessions
*/
@Deprecated
public class AddApplicationCache implements AugmenterProvider<ApplicationCache> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_LOCATION_CONTEXT;

/**
* @deprecated Uses a non W3C compliant capability and is not available in W3C WebDriver sessions
*/
@Deprecated
public class AddLocationContext implements AugmenterProvider<LocationContext> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

import static org.openqa.selenium.remote.CapabilityType.SUPPORTS_NETWORK_CONNECTION;

/**
* @deprecated Uses a non W3C compliant capability and is not available in W3C WebDriver sessions
*/
@Deprecated
public class AddNetworkConnection implements AugmenterProvider<NetworkConnection> {

@Override
Expand Down

0 comments on commit 348f17b

Please sign in to comment.