AppleScript: How to Change the value of a website option menu?

Viewed 115

I'm trying to change the value of an option menu of a website via AppleScript.

When I run:

tell application "Safari"
 activate
  tell current tab of window 1
   set changeValue to do JavaScript "document.getElementById('selected-ID').innerHTML;"
   return changeValue
  end tell
end tell

I get as result:

<option value=\"1\">blabla1</option>
<option selected=\"\" value=\"2\">blabla2</option>
<option value=\"3\">blabla3</option>

Now I want to change the selected option to be value1.

Can someone please help me. I'm getting really frustrated that nothing works

Thank you

Martin

1 Answers
Related