网页在柏树中没有加载,其中页面在chrome浏览器中完美加载

发布于 2025-02-13 04:23:54 字数 817 浏览 0 评论 0原文

中的开发控制台

以下是柏树

我尝试在下面添加config是cypress.json

{ “ modifyObStructiveCode”:false }

但这导致柏树跑者根本找不到我的测试,

这是我的柏树代码:

/// <reference types="Cypress" />

describe("Service Now TEST login", () => {
    it("Login TEST", () => {
        cy.visit("https://hptest.service-now.com/login.do")
        cy.wait(2000)
        cy.get(".form-control", {
            timeout: 10000
        }).should("be.visible").then(() => {
            cy.get("#user_name").type("");
            cy.get("#user_password").type("");
            cy.get("#sysverb_login").click();
        });
    })
})

请在这里帮助我。

Below is the dev console in cypress

enter image description here

I have tried adding below config is Cypress.json

{
"modifyObstructiveCode" : false
}

but this causes Cypress runner to not find my test at all

This is my Cypress code :

/// <reference types="Cypress" />

describe("Service Now TEST login", () => {
    it("Login TEST", () => {
        cy.visit("https://hptest.service-now.com/login.do")
        cy.wait(2000)
        cy.get(".form-control", {
            timeout: 10000
        }).should("be.visible").then(() => {
            cy.get("#user_name").type("");
            cy.get("#user_password").type("");
            cy.get("#sysverb_login").click();
        });
    })
})

Please help me here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

锦欢 2025-02-20 04:23:54

我可以在您的测试跑步者日志中看到存在异常,您可以使用以下例外:

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

因此您的代码应该看起来像:

describe('Service Now TEST login', () => {
  it('Login TEST', () => {
    cy.visit('https://hptest.service-now.com/login.do')
    //Catch Exception
    Cypress.on('uncaught:exception', (err, runnable) => {
      return false
    })
    cy.wait(2000)
    cy.get('.form-control', {
      timeout: 10000,
    })
      .should('be.visible')
      .then(() => {
        cy.get('#user_name').type('')
        cy.get('#user_password').type('')
        cy.get('#sysverb_login').click()
      })
  })
})

I can see in your test runner logs that there is a exception generated, you can catch the exception using:

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

So your code should look like:

describe('Service Now TEST login', () => {
  it('Login TEST', () => {
    cy.visit('https://hptest.service-now.com/login.do')
    //Catch Exception
    Cypress.on('uncaught:exception', (err, runnable) => {
      return false
    })
    cy.wait(2000)
    cy.get('.form-control', {
      timeout: 10000,
    })
      .should('be.visible')
      .then(() => {
        cy.get('#user_name').type('')
        cy.get('#user_password').type('')
        cy.get('#sysverb_login').click()
      })
  })
})
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文