Skip to content

example for waiting for a form submit #438

@tcurdt

Description

@tcurdt

I was just trying to submit a form - but I haven't found any docs (missed?) or examples that wait for form submit.
What's the correct way to wait for the page to have loaded in this case?

const agent = require('secret-agent');

(async () => {
  await agent.configure({ userAgent: '~ chrome = 88' });

  await agent.goto('https://www.duckduckgo.com/')
  await agent.waitForPaintingStable()
  console.log(await agent.url);

  await agent.click(agent.document.querySelector('#search_form_input_homepage'))
  await agent.type('foo')

  await agent.click(agent.document.querySelector('#search_button_homepage'))
  // await agent.waitForLocation('change')
  // await agent.waitForPaintingStable()
  await agent.waitForMillis(3000)

  await agent.close()
})()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions