Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

listenXHR / getXHR not working #53

Open
kretschmannj opened this issue Jun 2, 2020 · 0 comments
Open

listenXHR / getXHR not working #53

kretschmannj opened this issue Jun 2, 2020 · 0 comments

Comments

@kretschmannj
Copy link

The following code does not work ...

module.exports = {
'Listens and the Gets': function(browser) {
browser.listenXHR()
browser.url('https://www.yahoo.com')
browser.getXHR('yahoo', 5000, xhrs => {
// browser.waitForXHR('yahoo', 5000, '', xhrs => {
if (xhrs.length > 0) {
for (i = 0; i < xhrs.length; i++) {
console.log("\nMatch found:"
+ "\n\tURL: " + xhrs[i].url
+ "\n\tSTATUS: " + xhrs[i].status
+ "\n\tMETHOD: " + xhrs[i].method
+ "\n\tRESPONSE CODE: " + xhrs[i].httpResponseCode
)
}
} else {
console.log("No matching URLs found")
}
})
}
}
If I comment out the listenXHR and getXHR lines and uncomment the waitForXHR line then it works perfectly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant