Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Codeception BrowserMob Proxy extension Documentation

Greg Heitz edited this page Aug 6, 2016 · 5 revisions

Table of Contents

BrowserMob

  • Full name: \Codeception\Extension\BrowserMob
  • Parent class:

_open

BrowserMob::_open(  ): void

Open a new proxy using the PHPBrowserMobProxy_Client method


_close

BrowserMob::_close(  ): void

Close current proxy using the PHPBrowserMobProxy_Client method


_newHar

BrowserMob::_newHar( string $label='' ): \Requests_Response

Start new HAR using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$label='' string

_newPage

BrowserMob::_newPage( string $label='' ): \Requests_Response

Start new HAR page using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$label='' string

_blacklist

BrowserMob::_blacklist( string $regexp, integer $status_code ): \Requests_Response

Blacklist URLs using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$regexp string
$status_code integer

_whitelist

BrowserMob::_whitelist( string $regexp, integer $status_code ): \Requests_Response

Whitelist URLs using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$regexp string
$status_code integer

_basicAuth

BrowserMob::_basicAuth( string $domain, array<mixed,string> $options ): \Requests_Response

Set HTTP authentication headers using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$domain string
$options array<mixed,string>

_headers

BrowserMob::_headers( array<mixed,string> $options ): \Requests_Response

Override requests HTTP headers using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$options array<mixed,string>

_responseInterceptor

BrowserMob::_responseInterceptor( string $js ): \Requests_Response

Intercept HTTP responses using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$js string

_requestInterceptor

BrowserMob::_requestInterceptor( string $js ): \Requests_Response

Intercept HTTP requests using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$js string

_limits

BrowserMob::_limits( array<mixed,string> $options ): \Requests_Response

Set proxy limits using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$options array<mixed,string>

_timeouts

BrowserMob::_timeouts( array<mixed,string> $options ): \Requests_Response

Set proxy timeouts using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$options array<mixed,string>

_remapHosts

BrowserMob::_remapHosts( string $address, string $ip_address ): \Requests_Response

Map hosts to IP using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$address string
$ip_address string

_waitForTrafficToStop

BrowserMob::_waitForTrafficToStop( integer $quiet_period, integer $timeout ): \Requests_Response

Wait for traffic before stopping proxy using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$quiet_period integer
$timeout integer

_clearDnsCache

BrowserMob::_clearDnsCache(  ): \Requests_Response

Flux proxy DNS cache using the PHPBrowserMobProxy_Client method


_rewriteUrl

BrowserMob::_rewriteUrl( string $match, string $replace ): \Requests_Response

Rewrite URLs using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$match string
$replace string

_retry

BrowserMob::_retry( integer $retry_count ): \Requests_Response

Set proxy retries using the PHPBrowserMobProxy_Client method

Parameters:

Parameter Type Description
$retry_count integer

getProxyPort

Return current proxy port opened on BrowserMobProxy

BrowserMob::getProxyPort(  ): integer

Return Value:

Proxy port


setProxyPort

Set current proxy port to use on BrowserMobProxy

BrowserMob::setProxyPort( integer $port ): integer

Parameters:

Parameter Type Description
$port integer Proxy port

openProxy

Open a new proxy on BrowserMobProxy

BrowserMob::openProxy( array<mixed,mixed>|null, $capabilities = null ): integer

Parameters:

Parameter Type Description
$capabilities array<mixed,mixed>|null Array of capabilities. Use extension configuration if null

Return Value:

Proxy port

See Also:

  • BrowserMob::__setProxyCapabilities

closeProxy

Close the current proxy opened BrowserMobProxy Not supported by library chartjes/php-browsermob-proxy

BrowserMob::closeProxy(  ): void

startHar

Start to capture the HTTP archive

BrowserMob::startHar( string|null $label = '' ): boolean

Parameters:

Parameter Type Description
$label string|null Title of first HAR page

Return Value:

Command status


addPage

Add a new page to the HTTP archive

BrowserMob::addPage( string|null $label = '' ): boolean

Parameters:

Parameter Type Description
$label string|null Title of new HAR page

Return Value:

Command status


getHar

Get the HTTP archive captured

BrowserMob::getHar(  ): array<mixed,mixed>

Return Value:

HTTP archive


setHeaders

Override HTTP request headers

BrowserMob::setHeaders( array<string,string> $headers ): boolean

Parameters:

Parameter Type Description
$headers array<string,string>

Return Value:

Command status


redirectUrl

Rewrite URLs with regex

BrowserMob::redirectUrl( string $match, string $replace ): boolean

Parameters:

Parameter Type Description
$match string Matching URL regular expression
$replace string Replacement URL

Return Value:

Command status


filterRequest

Run Javascript against requests before sending them

BrowserMob::filterRequest( string $script ): boolean

Parameters:

Parameter Type Description
$script string Javascript code

Return Value:

Command status


filterResponse

Run Javascript against responses received

BrowserMob::filterResponse( string $script ): boolean

Parameters:

Parameter Type Description
$script string Javascript code

Return Value:

Command status



This document was automatically generated from source code comments on 2016-07-17 using phpDocumentor and cvuorinen/phpdoc-markdown-public