Package com.codeborne.selenide.proxy
Class SelenideProxyServer
java.lang.Object
com.codeborne.selenide.proxy.SelenideProxyServer
Selenide own proxy server to intercept server responses
It holds map of request and response filters by name.
-
Constructor Summary
ModifierConstructorDescriptionSelenideProxyServer
(Config config, @Nullable org.openqa.selenium.Proxy outsideProxy) Create server Note that server is not started nor activated yet.protected
SelenideProxyServer
(Config config, @Nullable org.openqa.selenium.Proxy outsideProxy, com.browserup.bup.BrowserUpProxy proxy) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRequestFilter
(String name, com.browserup.bup.filters.RequestFilter requestFilter) Add a custom request filter which allows to track/modify all requests from browser to servervoid
addResponseFilter
(String name, com.browserup.bup.filters.ResponseFilter responseFilter) Add a custom response filter which allows to track/modify all server responses to browsercom.browserup.bup.BrowserUpProxy
getProxy()
Method return current instance of browser up proxy@Nullable org.openqa.selenium.Proxy
Returns a "selenium" proxy that can be used by webdriver.boolean
<T extends com.browserup.bup.filters.RequestFilter>
@Nullable TrequestFilter
(String name) Get request filter by name<T extends com.browserup.bup.filters.ResponseFilter>
@Nullable TresponseFilter
(String name) Get response filter by namevoid
shutdown()
Stop the servervoid
start()
Start the servertoString()
-
Constructor Details
-
SelenideProxyServer
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, com.browserup.bup.BrowserUpProxy proxy)
-
-
Method Details
-
getSeleniumProxy
public @Nullable org.openqa.selenium.Proxy getSeleniumProxy()Returns a "selenium" proxy that can be used by webdriver. Available after SelenideProxyServer.start() and SelenideProxyServer.createSeleniumProxy() call. -
start
public void start()Start the serverIt automatically adds one response filter "download" that can intercept downloaded files.
-
isStarted
public boolean isStarted() -
addRequestFilter
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
Add a custom response filter which allows to track/modify all server responses to browser- Parameters:
name
- unique name of filterresponseFilter
- the filter
-
shutdown
public void shutdown()Stop the server -
getProxy
public com.browserup.bup.BrowserUpProxy getProxy()Method return current instance of browser up proxy- Returns:
- browser up proxy instance
-
toString
-
requestFilter
Get request filter by name -
responseFilter
Get response filter by nameBy default, the only one filter "download" is available.
-
responseMocker
-