如何使用Cypress点击Chessground棋盘上的棋子
无法用Cypress触发Chessground棋盘的棋子点击事件
我正尝试使用Cypress点击Chessground棋盘上的棋子,但始终无法触发点击事件,猜测这可能与Chessground的点击绑定方式或SVG相关有关。
已尝试的方法
cy.get("cg-board") .should("be.visible") .trigger("mousedown", offset.x, offset.y, { force: true, }); cy.get("svg.cg-shapes") .should("be.visible") .trigger("mousedown", offset.x, offset.y, { force: true, }); cy.get("svg.cg-custom-svgs") .should("be.visible") .trigger("mousedown", offset.x, offset.y, { force: true, }); cy.get("div.cg-wrap") .should("be.visible") .trigger("mousedown", offset.x, offset.y, { force: true, }); cy.get("piece.white.pawn:nth(1)") .should("be.visible") .trigger("mousedown", { force: true }); cy.get("cg-board").should("be.visible").click(offset.x, offset.y, { force: true, }); cy.get("svg.cg-shapes").should("be.visible").click(offset.x, offset.y, { force: true, }); cy.get("svg.cg-custom-svgs") .should("be.visible") .click(offset.x, offset.y, { force: true, }); cy.get("div.cg-wrap").should("be.visible").click(offset.x, offset.y, { force: true, }); cy.get("piece.white.pawn:nth(1)") .should("be.visible") .click({ force: true });
调试时的点击情况

内容的提问来源于stack exchange,提问作者Trufa
相关产品推荐
相关产品推荐

