Package com.codeborne.selenide.proxy
Class SelenideProxyServer
- java.lang.Object
-
- com.codeborne.selenide.proxy.SelenideProxyServer
-
@ParametersAreNonnullByDefault public class SelenideProxyServer extends java.lang.ObjectSelenide own proxy server to intercept server responses It holds map of request and response filters by name.
-
-
Constructor Summary
Constructors Modifier Constructor Description SelenideProxyServer(Config config, org.openqa.selenium.Proxy outsideProxy)Create server Note that server is not started nor activated yet.protectedSelenideProxyServer(Config config, org.openqa.selenium.Proxy outsideProxy, InetAddressResolver inetAddressResolver, com.browserup.bup.BrowserUpProxy proxy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRequestFilter(java.lang.String name, com.browserup.bup.filters.RequestFilter requestFilter)Add a custom request filter which allows to track/modify all requests from browser to servervoidaddResponseFilter(java.lang.String name, com.browserup.bup.filters.ResponseFilter responseFilter)Add a custom response filter which allows to track/modify all server responses to browserorg.openqa.selenium.ProxycreateSeleniumProxy()Converts this proxy to a "selenium" proxy that can be used by webdrivercom.browserup.bup.BrowserUpProxygetProxy()Method return current instance of browser up proxybooleanisStarted()<T extends com.browserup.bup.filters.RequestFilter>
TrequestFilter(java.lang.String name)Get request filter by name<T extends com.browserup.bup.filters.ResponseFilter>
TresponseFilter(java.lang.String name)Get response filter by name By default, the only one filter "download" is available.voidshutdown()Stop the servervoidstart()Start the server It automatically adds one response filter "download" that can intercept downloaded files.java.lang.StringtoString()
-
-
-
Constructor Detail
-
SelenideProxyServer
public SelenideProxyServer(Config config, @Nullable org.openqa.selenium.Proxy outsideProxy)
Create server Note that server is not started nor activated yet.- Parameters:
outsideProxy- another proxy server used by test author for his own need (can be null)
-
SelenideProxyServer
protected SelenideProxyServer(Config config, @Nullable org.openqa.selenium.Proxy outsideProxy, InetAddressResolver inetAddressResolver, com.browserup.bup.BrowserUpProxy proxy)
-
-
Method Detail
-
start
public void start()
Start the server It automatically adds one response filter "download" that can intercept downloaded files.
-
isStarted
@CheckReturnValue public boolean isStarted()
-
addRequestFilter
public void addRequestFilter(java.lang.String name, com.browserup.bup.filters.RequestFilter requestFilter)Add a custom request filter which allows to track/modify all requests from browser to server- Parameters:
name- unique name of filterrequestFilter- the filter
-
addResponseFilter
public void addResponseFilter(java.lang.String name, com.browserup.bup.filters.ResponseFilter responseFilter)Add a custom response filter which allows to track/modify all server responses to browser- Parameters:
name- unique name of filterresponseFilter- the filter
-
createSeleniumProxy
@CheckReturnValue @Nonnull public org.openqa.selenium.Proxy createSeleniumProxy()
Converts this proxy to a "selenium" proxy that can be used by webdriver
-
shutdown
public void shutdown()
Stop the server
-
getProxy
@CheckReturnValue @Nonnull public com.browserup.bup.BrowserUpProxy getProxy()
Method return current instance of browser up proxy- Returns:
- browser up proxy instance
-
toString
@CheckReturnValue @Nonnull public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
requestFilter
@CheckReturnValue @Nullable public <T extends com.browserup.bup.filters.RequestFilter> T requestFilter(java.lang.String name)
Get request filter by name
-
responseFilter
@CheckReturnValue @Nullable public <T extends com.browserup.bup.filters.ResponseFilter> T responseFilter(java.lang.String name)
Get response filter by name By default, the only one filter "download" is available.
-
-