Search code examples
javascripthtmlchromeless

Chromeless - can not click input submit button


I am trying with chromeless to click on a submit button whose code is:

<input value="Submit" onclick="normal_upload()" id="submitbutton" type="button">

I have tried

const screenshot = await chromeless
        .click('input#submitbutton')

and

const screenshot = await chromeless
        .click('#submitbutton')

and

const screenshot = await chromeless
        .click('input[value="Submit"]')

but none of these seem to work (nothing happens, and no error message).

What could be blocking the click?


Solution

  • With some luck, setting the scrollBeforeClick option to true in the Chromeless constructor options may solve the problem. If that does not help, or if it breaks something else, it might be worth trying to use the .scrollToElement() method to scroll to an element located some distance below the element that needs to be clicked. (It seems that scrolling is sometimes a few lines short of the necessary amount.)