cypress:它点击了按钮,但它进行了鼠标悬停而不是单击,因此它不保存表单

问题描述 投票:0回答:0

我会很感激一些帮助。它不是单击以保存表单,而是进行鼠标悬停。 在下面找到角度的 HTML:

在我的代码下面,我正在调用一个方法,我尝试了所有这些替代方案,它们中的任何一个都有效;在所有情况下,它都会进行鼠标悬停,但不会单击并保存表格:


static saveLoc() {
    //return cy.contains('save');  

    cy.wait(2000)
    cy.get('[mattooltip="Save as a draft location"]')
      .trigger("click")
      .click({force: true}) 

    // cy.get('[mattooltip="Save as a draft location"]')
    //   .should('be.visible')
    //   .trigger('mouseover')
    //   .click({ force: true });

    // return cy.get('[mattooltip="Save as a draft location"]')
    // .focus().click({force: true})

  // cy.get('[mattooltip="Save as a draft location"]')
  //   .trigger('mouseover').click();

  // cy.get('[id*="edit-mode-buttons"]')
  //   .find('button')
  //   .contains('save text')
  //   .click({force: true});
  }

第一个选项工作了几个月,今天开始失败了。

cypress
© www.soinside.com 2019 - 2024. All rights reserved.