JavaScript puppeteer - how to submit form puppeteer submit form wait

How do I submit the form? I have a simple search bar and a search button. The following enters the search string, but the click event is not fired. When headless is set to false and I manully click enter in the serachfield, the search is working. How to submit the button?

  const puppeteer = require('puppeteer');

(async () => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.goto('http://localhost:3000', {waitUntil: 'networkidle'});

await page.focus('#search');

// Type our query into the search bar
await page.type('michael');

// Submit form
await page.press('Enter');

await page.screenshot({path: './screenshots/search3.png'});

browser.close();
})();

My searchbar

search(e) {
 e.preventDefault();
this.props.onClick(this.props.value);}

render() {
return (<form className="form-inline" id="search-form" onSubmit
{this.search}>
  <div className="form-group">
    <input
      type="text"
      className="form-control"
      id="search"
      value={this.props.value}
      placeholder={this.props.placeHolder}
      onChange={this.props.onChange}
    />

    <button primary type="submit" >
      {this.props.buttonText}
    </button>
  </div>
</form>);
}

UPDATE

This is not working:

const searchForm = await page.$('#search-form'); 
await searchForm.evaluate(searchForm => searchForm.submit()); 

It does a postback and the text in the form was cleared, even though it should trigger the function with preventDefault.

So the issue seems to be this line of code await

searchForm.evaluate(searchForm => searchForm.submit());

This is working:

I changed the code to:

await page.click('#search-button'); 
await page.waitForNavigation(); 
Answer:1

I solved it by using this instead of submitting the form:

await page.click('#search-button'); 
await page.waitForNavigation(); 
Answer:2

I have an application which is built with node.js and react.js and is universal (or "isomorphic" as they were called before) and speaks with REST API to get data. In render method of some component ...

I have an application which is built with node.js and react.js and is universal (or "isomorphic" as they were called before) and speaks with REST API to get data. In render method of some component ...

I am using owl-carousel which is working pretty good when I load items directly. Although, when I try to load items through AJAX, those been rendered but not been displayed properly and not even ...

I am using owl-carousel which is working pretty good when I load items directly. Although, when I try to load items through AJAX, those been rendered but not been displayed properly and not even ...

  1. carousel doesn't slide
  2. carousel doesn't work
  3. carousel doesn't work bootstrap 4
  4. carousel doesn't start automatically
  5. bootstrap carousel doesn't work
  6. carousel does not resize
  7. bootstrap carousel doesn't slide
  8. owl carousel doesn't work
  9. bootstrap carousel doesn't slide automatically
  10. owl carousel doesn't show
  11. slick carousel doesn't work
  12. wallpaper carousel doesn't work
  13. materialize carousel doesn't work
  14. my carousel doesn't slide
  15. the carousel doesn't stop turning
  16. bootstrap carousel doesn't stop on hover
  17. owl carousel doesn't loop
  18. diptyque carousel doesn't work
  19. carousel slider doesn't work
  20. bootstrap carousel doesn't work angular

I created network in vis.js, but I need add icon to node, for example "plus", and then add handler to this icon. How I can do this?

I created network in vis.js, but I need add icon to node, for example "plus", and then add handler to this icon. How I can do this?

  1. nodejs icon
  2. nodes icon tweak - xf2
  3. xfa nodes icon tweak
  4. lymph nodes icon
  5. music notes icon
  6. server nodes icon
  7. music notes icon vector
  8. user coins icon
  9. node icon tweak
  10. xfa nodes icon tweak 3.0.0
  11. icon nodes mind map
  12. icon treeview nodes

I have one array called data I need to display each values of data array in a div.This is my function function myFunction(data) { var result = ""; for (var i = 0; i < data.length; i++) ...

I have one array called data I need to display each values of data array in a div.This is my function function myFunction(data) { var result = ""; for (var i = 0; i < data.length; i++) ...