1

I'm trying to automate a repetitive process on our company's expenses claim intranet site. The task requires clicking some buttons (easy to automate), and then selecting from a dropdown menu (which is where I struggle).

There are 2 dropdown menus on the webpage, "expense type" and "allowance type". The key point is that the second dropdown ("allowance type") dynamically changes based on the user's selection in the first dropdown.

I can get as far as:

do JavaScript "  document.getElementById('" & theId & "').value ='" & theValue & "';" in document 1

This successfully selects the item I want from the first dropdown menu, but the expected behaviour is that the second submenu should poplulate, allowing me to select the "expense type". This doesn't happen. Instead, the second menu stays unpoplulated, as though I hadn't made a selection in the first menu.

Clearly, there's some JavaScript on the page that's waiting for the user to interact with the first menu before populating the second one.

How can I get the browser to "see" that I've made a selection from the first menu?

  • 1
    Have you tried doing "Watch Me Do", then converting it to Applescript?(see here) – abc Oct 30 '18 at 19:20
  • Great suggestion - I didn't know about that feature. Thank you. – jsm Oct 30 '18 at 19:49
  • If it works, request to close this question as a duplicate(and could you please also upvote my answer) – abc Oct 30 '18 at 20:31
  • It's a great suggestion, but it doesn't work consistently. Second menu doesn't always update. I have been able to work around this by introducing a delay before selecting the second menu, but this isn't optimal. I'm specifically looking for a way to make sure the browser (i.e. the site's JavaScript) notices the interaction and updates accordingly. – jsm Oct 30 '18 at 21:59

You must log in to answer this question.

Browse other questions tagged .