'Capture Request Payload from Web Browser Automation Javascript

I am trying to capture the PAYLOAD of a POST call. I have successfully been able to implement this using browser.mock in webdriverio. but, this is not supported for firefox and other browsers. Can anyone help me with an alternative?

const output = await  browser.mock('https://somerequesturldata', {method: 'post'});

await  browser.url('https://thesiteiambrowsing')
console.log(output.calls[0].postData)

I have tried fetch, but i think it is only grabbing the response which is not what I need.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source