Robotics: How to simulate pressing the enter key on a website

I am automating functionality within a webpage launched in Internet Explorer (required) which is made up of several forms with several rows/columns within each form. There is a default amount of rows which show up in each form and is capped at 12. However, when the user clicks on a text box within the last row and presses the enter key, a new row will appear.

Now let’s say I need to enter data for 15 rows. I need to add three more rows. However, I am really struggling to find a way to simulate the user pressing the enter key.

I’ve looked at RaiseEvent options (onkeydown, onkeyup) but there doesn’t appear to be a way of passing an argument to tell the website which key has been pressed. This is important as the function in the .js is specifically looking for event.keyCode == 13.

I don’t see any other way of adding the new rows I need without the user pressing the enter key.

I’ve tried extracting the function code to create a customized function but it isn’t working. There are too many undefined function exceptions being thrown for functions not within the .js file. I’m not sure where to find them either.

Any help you can provide will be greatly appreciated.

I have done this before using JavaScript. I cannot find that example though. You’ll need to write a JavaScript function to raise that key code.

Hi. Thank you so much for your response. I reviewed this article along with more than a dozen others but was not able to find a resolution with this approach.

However, I was able to resolve my overall dilemma of adding additional lines by putting a value into the last box and raising an “onchange” event. The website will add additional rows this way.

I guess the trick is to never give up and perhaps find a solution which will work outside of the one we’re laser-focused on.

Thanks for sharing your resolution and your positivity wiht us @StephenS9927!

We hope to continue to see you around here in the PCC!

Sometimes it requires hands-on to resolve things like this. Thank you for your words of encouragement! They do help others. If I do find that script, I will post it in another article.