Package io.appium.java_client
Class AppiumUserAgentFilter
- java.lang.Object
-
- io.appium.java_client.AppiumUserAgentFilter
-
- All Implemented Interfaces:
java.util.function.Function<org.openqa.selenium.remote.http.HttpHandler,org.openqa.selenium.remote.http.HttpHandler>,org.openqa.selenium.remote.http.Filter
public class AppiumUserAgentFilter extends java.lang.Object implements org.openqa.selenium.remote.http.FilterManage Appium Client configurations.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringUSER_AGENTA default User Agent name for Appium Java client.static java.lang.StringVERSION_KEY
-
Constructor Summary
Constructors Constructor Description AppiumUserAgentFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.openqa.selenium.remote.http.HttpHandlerapply(org.openqa.selenium.remote.http.HttpHandler next)static java.lang.StringbuildUserAgent(java.lang.String userAgent)Returns the User Agent.static booleancontainsAppiumName(java.lang.String userAgent)Returns true if the given User Agent includes "appium/", which implies the User Agent already has the Appium UA by this method.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
VERSION_KEY
public static final java.lang.String VERSION_KEY
- See Also:
- Constant Field Values
-
USER_AGENT
public static final java.lang.String USER_AGENT
A default User Agent name for Appium Java client. e.g. appium/8.2.0 (selenium/4.5.0 (java mac))
-
-
Method Detail
-
containsAppiumName
public static boolean containsAppiumName(@Nullable java.lang.String userAgent)Returns true if the given User Agent includes "appium/", which implies the User Agent already has the Appium UA by this method. The matching is case-insensitive.- Parameters:
userAgent- the User Agent in the request headers.- Returns:
- whether the given User Agent includes Appium UA like by this filter.
-
buildUserAgent
public static java.lang.String buildUserAgent(@Nullable java.lang.String userAgent)Returns the User Agent. If the given UA already hasUSER_AGENT_PREFIX, it returns the UA. IF the given UA does not haveUSER_AGENT_PREFIX, it returns UA with the Appium prefix.- Parameters:
userAgent- the User Agent in the request headers.- Returns:
- the User Agent for the request
-
apply
public org.openqa.selenium.remote.http.HttpHandler apply(org.openqa.selenium.remote.http.HttpHandler next)
- Specified by:
applyin interfacejava.util.function.Function<org.openqa.selenium.remote.http.HttpHandler,org.openqa.selenium.remote.http.HttpHandler>
-
-