Automating a form: Form error, Uncaught TypeError: Cannot read property ‘value’ of null

666 Views Asked by At

I am trying to automate a form but i get an error.

Uncaught TypeError: Cannot read property 'value' of null

This is the JS code.

var elemFound = SingleNodeForXPath( searchTitle );
var result = elemFound.value; #### Uncaught TypeError: Cannot read property 'value' of null ###
return "GOOD:" + result;
})();

This is the end of the js code and error.

This is the HTML code.

<input class="form-control decimal " id="time_card.monday" name="time_card.monday" 
maxlength="14" value="" onchange="this.value=formatNumber(this.value);onChange('time_card.monday');" style="; " aria-label="Monday">

Thanks for all the help in advance.

I am using keyboard maestro to automate it :)

1

There are 1 best solutions below

0
On

This error means that the SingleNodeForXPath( searchTitle ); function was unable to find the element you are looking for.

You can try document.getElementById('time_card.monday') instead.