I am trying to write a script to make selections on a webpage in Safari.
So far my code is this
So this opens the webpage and tabs to the appropriate selection (attached Jpg of portion of screen) The it uses keystroke "P" to make a selection and then a return keystroke. Now I need it to select the "submit" button which I attempted to do, but did not work.
So how do I select the submit button.
I believe this is the source of the submit button
<input type="button" id="order_list_button_search" value="Search">
Once I figure out how to select the button, then I need to select the the top "checkbox" in the screenshot.png
So far my code is this
Code:
tell application "Safari"
activate
do JavaScript "window.open('https://www.redwagontoy.com/miva/admin.mvc?Screen=MORD&Store_Code=RWTC')" in document 1
delay 3 -- need to allow enough time for the web page to load; adjust as necessary
end tell
tell application "System Events"
tell process "Safari"
repeat 3 times -- where x = the number of times it takes to reach the button using the tab key
keystroke tab
end repeat
delay 3
keystroke "P"
keystroke return -- performs the press action
tell application "Safari"
activate
do JavaScript "document.forms['search']['order_list_search_batch'].click()"
end tell
end tell
end tell
So this opens the webpage and tabs to the appropriate selection (attached Jpg of portion of screen) The it uses keystroke "P" to make a selection and then a return keystroke. Now I need it to select the "submit" button which I attempted to do, but did not work.
So how do I select the submit button.
I believe this is the source of the submit button
<input type="button" id="order_list_button_search" value="Search">
Once I figure out how to select the button, then I need to select the the top "checkbox" in the screenshot.png