最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - typing into an input field using Cypress - Stack Overflow

programmeradmin17浏览0评论
describe('My First Test', () => {
  it('Visits Replpad', () => {
    cy.visit('/')
    cy.get('input').type('now')
  })
}) 

Trying to type some text into the bottom input field but it times out trying to find the input field. I've extended the time out period up to 10,000 but it still doesn't see the input field.

Is there a solution to this?

describe('My First Test', () => {
  it('Visits Replpad', () => {
    cy.visit('http://hostilefork./media/shared/replpad-js/')
    cy.get('input').type('now')
  })
}) 

Trying to type some text into the bottom input field but it times out trying to find the input field. I've extended the time out period up to 10,000 but it still doesn't see the input field.

Is there a solution to this?

Share Improve this question edited Dec 19, 2021 at 5:52 Graham Chiu asked Dec 19, 2021 at 5:43 Graham ChiuGraham Chiu 4,8863 gold badges26 silver badges42 bronze badges 3
  • 1 Please show the dom structure of you page – Mikhail Bolotov Commented Dec 19, 2021 at 12:38
  • The console appears here github./hostilefork/replpad-js/blob/master/index.html#L121 in consult_out, and is created here github./hostilefork/replpad-js/blob/master/replpad.reb#L350 – Graham Chiu Commented Dec 19, 2021 at 14:05
  • why not just look into the DOM as it shown in the Cypress runner after you've execute your test? It shows it exactly as it was at the moment when Cypress was trying to find the input element. – Mikhail Bolotov Commented Dec 19, 2021 at 14:59
Add a ment  | 

1 Answer 1

Reset to default 4

instead of

cy.get('input').type('now')

try

cy.get('.input').type('now')

because you are looking for the class name not for the tag

发布评论

评论列表(0)

  1. 暂无评论