describe('Store login', () => { it('login to Stor" /> describe('Store login', () => { it('login to Stor" /> describe('Store login', () => { it('login to Stor"/>

Getting 403 forbidden in cypress for a simple login hosted on akamai

1.1k Views Asked by At

I am running this script to access a website hosted under akamai :


/// <reference types="cypress" />


 describe('Store login', () => {
  it('login to Store', () => {
    cy.visit(("https://store.qlsit.qantas.com/"),{
    headers: {
      "Accept" : "application/json, text/plain, */*",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
      "LOYALTY-PARTNER-FORWARD": "D19313AA-5BFF-4586-947A-C3AE8D78CEA4"
            }
        })
      })
     })

I am getting 403 forbidden .

I am not sure what header to add here to pass akamai blocker to access the website?

I have tried with different user-agent but it still doesn't work.

1

There are 1 best solutions below

0
Guillaume On

As explained in previous commands, your issue seems to be related with the way you are calling cy.visit function. Url should be part of options, a separated argument is not well supported. Please try the following:

 describe('Store login', () => {
  it('login to Store', () => {
    cy.visit({
    url: "https://store.qlsit.qantas.com/",
    headers: {
      "Accept" : "application/json, text/plain, */*",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
      "LOYALTY-PARTNER-FORWARD": "D19313AA-5BFF-4586-947A-C3AE8D78CEA4"
            }
        })
      })
     })

Make sure your version of cypress is recent enough and if the error persist, you may reach out to webmaster (or Akamai representative if you are customer) to get more information about that 403.