OXYGEN
HomeGitHubReleasesCommunity
  • Welcome to Oxygen
  • About
    • What is Oxygen?
    • Getting Started (Videos)
      • Oxygen IDE Controls Overview
      • Recording a Web Test
      • Oxygen Commands Explained
    • Getting help
  • Download and work with Oxygen
    • Download & Installation
      • Oxygen IDE Installation
      • Oxygen for Mobile Installation
      • Oxygen for Windows Desktop Automation Setup
      • Oxygen for Mac Installation
        • Mac Installation Troubleshooting
      • Oxygen CLI Installation
      • Java Installation Instructions
      • Recording Troubleshooting
    • Start working with Oxygen
      • Getting Started - Web
        • Introduction - Web Testing
        • Recording a Web Test
        • Creating a Web Test
        • Sample Project - Web Test
      • Getting Started - Mobile
        • Introduction - Mobile Testing
        • Recording a Test on Mobile
        • Creating a Test - Mobile
        • Sample Project - Mobile
      • Getting Started - Oxygen for Windows Desktop Automation
      • Getting Started- Oxyge CLI
        • Running a Test Script on Windows
        • Running Multiple Tests (Suites) on Windows
    • Oxygen Modules
      • assert
      • date
      • db
      • email
      • eyes
      • http
      • log
      • mailinator
      • mob
      • pdf
      • proxy
      • serial
      • shell
      • soap
      • twilio
      • utils
      • web
      • win
    • Test Parameters
  • Cloud Providers
    • Sauce Labs
    • Lambda Test
    • TestObject
  • Advanced programming in Oxygen
    • Project Configuration
    • Locating Elements
    • Page Objects
    • Environments
    • Code Components
Powered by GitBook
On this page
  • assertStatusCode
  • assertUrl
  • dispose
  • getRequests
  • init
  • start
  • stop
  • waitFor
  • waitForUrl

Was this helpful?

  1. Download and work with Oxygen
  2. Oxygen Modules

proxy

Provides methods for intercepting network traffic via mitmproxy.

assertStatusCode

Assert whether HTTP response status code matches the specified value.

Parameters:

Name
Type
Description

url

String|RegExp

A request URL to match verbatim or a RegExp.

statusCode

Number

A response status code to match verbatim or a RegExp.

failureMessage

String

optional An optional failure message.

timeout

Number

optional Timeout. Default is 60 seconds.

Returns:

Object - Network request details if the network request was found.

assertUrl

Assert if network request matching the specified URL.

Parameters:

Name
Type
Description

url

String|RegExp

A request URL to match verbatim or a RegExp.

timeout

Number

optional Timeout. Default is 60 seconds.

Returns:

Object - Network request details if the network request was found.

dispose

Disposes this module.

getRequests

Return all the collected network requests so far.

Returns:

Array.<Object> - Array containing network requests.

init

Initializes proxy.

** Launching mitmproxy manually:**

mitmdump --anticache -s mitmproxy-node\scripts\proxy.py --ssl-insecure --set httpCommPort=8765

Parameters:

Name
Type
Description

proxyPort

Number

Proxy port.

proxyCommPort

Number

optional Port for internal proxy communication. If specified, then mitmproxy should be launched manually.Otherwise mitmpoxy will be launched automatically.

saveRequestBody

Boolean

optional Save request bodies.

saveResponseBody

Boolean

optional Save response bodies.

start

Begin collecting network requests.

Any previously collected requests will be discarded.

** Usage example:**

proxy.init(8080);
proxy.start();
// print the collected request so far:
let requests = proxy.getRequests();
for (let req of requests) {
 log.info(req);
}
// wait for a request using a verbatim URL match:
proxy.waitForUrl('https://www.yourwebsite.com/foo/bar');
// wait for a request using a regular expression URL match:
proxy.waitForUrl(/https:\/\/.*\/foo\/bar/);
// wait for a request using a custom matcher:
proxy.waitFor(function (request) {
 return request.status === '200' && request.url === 'https://www.yourwebsite.com/foo/bar';
});

stop

Stop collecting network requests.

waitFor

Wait for a network request.

Parameters:

Name
Type
Description

matcher

Function

Matching function. Should return true on match, or false otherwise.

timeout

Number

optional Timeout. Default is 60 seconds.

Returns:

Object - Network request details if the network request was found.

waitForUrl

Wait for a network request matching the specified URL.

Parameters:

Name
Type
Description

pattern

String|RegExp

An URL to match verbatim or a RegExp.

timeout

Number

optional Timeout. Default is 60 seconds.

Returns:

Object - Network request details if the network request was found.

PreviouspdfNextserial

Last updated 2 years ago

Was this helpful?