Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

220
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda