MorLavender
MorLavender

Reputation: 106

Puppeteer click on button not executed

I'm trying to execute the below code in order to click on button:

await page.evaluate(() => {
    document.querySelector('button1 bg-white[type=submit]').click();
});

This is my HTML code (in my React app render):

<Button size="mini" className= "button1 bg-white" onClick={() => {
                            this.onChangeTimeFilter('7d')
                        }} primary={this.state.timeFilter === '7d'} content="7d"/>

Upvotes: 1

Views: 3618

Answers (1)

goofballLogic
goofballLogic

Reputation: 40459

Your selector needs to be '.button1.bg-white'

Note:

  1. period before each class name
  2. No space between the "button1" and "bg-white" class names
  3. I removed [type=submit] because there's nothing in your JSX code to indicate you have a submit button there

Upvotes: 1

Related Questions