Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

214
Vistas
Child tab with NO target attribute in Cypress

I got a really tough issue while writing the scripts in Cypress. I clicked an element and it directs to a new page. I want to click the next element on the new page. I know that Cypress doesn't allow to work on a new window simultaneously.

So I tried solving with many solutions available in the web.

I got the same error that it could not click the element on the new tab. I have attached the html body of the screen. Can someone please help me out to solve the issue.

This is the html body

The following was my code..

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

describe('ship test',() =>{
it('first test',() =>{
cy.viewport(1120,800)
cy.visit('url')
cy.get('#LoginForm-login_authname').type('12345)
cy.get('#LoginForm-login_authid').type('12345{enter}')

cy.on('uncaught:exception', (err, runnable) => {
return false
})

cy.wait[cy.xpath('//span[normalize-space()="Work"]')
.click({force: true})]

cy.xpath('//*[@id="VTK-j_idt1184"]',{timeout : 700000}).click()
cy
.window().then((win) => {
cy.spy(win, 'open').as('redirect');
});
cy
.xpath('//a[@class="ui-commandlink ui-widget btn_wrapper pull-right createtask_btn"]',{timeout : 700000})
.click();
cy
.get('@redirect')
.should('be.calledWith', 'href', '/about');
})
})

The error.. This is the imageenter code here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It looks like this

cy.xpath('//*[@id="VTK-j_idt1184"]',{timeout : 700000}).click()

and this

cy.xpath('//a[@class="ui-commandlink ui-widget btn_wrapper pull-right createtask_btn"]',{timeout : 700000})
.click();

are trying to click the same link.

Try removing the 1st one. (you need to click after the spy is set).

To test the new tab, is easiest to visit in a new test.

it('tests the about tab', () => {
  cy.visit('/about');
  ...

Footnote

If click() does not work, you may have more luck trying .realClick().

See Cypress Real Events written by Dmitriy Kovalenko (Ukraine).

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda