Skip to content

links.map is not a function #2

@ShcherbakovDen

Description

@ShcherbakovDen

I have tried ti use your code but i got error links.map is not a function.
I rewritten code as
`describe('broken link test', function() {
it('should check the page for broken links', async function () {
browser.url('/status_codes/200');

    // get all the links on the page
    const links = $$('a');

    const urls = (await links).map(link => link.getAttribute('href'));

    const requests = urls.map(url => fetch(url));

    const responses = await Promise.all(requests);

    const statusCodes = responses.map(response => response.status);

    statusCodes.forEach(statusCode => {
        expect(statusCode).to.be.below(400);
    })
});

});`

but now i take error "Only absolute URLs are supported"
Can you help me debug this code for right work?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions