Responsive Ad Area

Share This Post

test

How to get redirect status in puppeteer?

I’m trying write Jest test using puppeteer

describe('Downloads', () => {
it(`should refirect to download page for ios`, async () => {
    await page.setUserAgent('exotic');
    let response = await page.goto(`http://localhost:8888/downloads`, {waitUntil: "networkidle0"});
    let url = page.url();
    expect(response.status()).toBe(303);
    expect(url).toBe(`http://localhost:8888/downloads/ios`);
});

});

But response status is 200 because goto return response for http://localhost:8888/downloads/ios

How to get redirect status code?


How to get redirect status in puppeteer?
How to get redirect status in puppeteer?
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar