Following the loss of Yahoo API for downloading data I am trying to write a script that will down load historical prices and dividends. I have managed to get it working with prices but cannot work out how to get the dividend information.
The script that follows is truncated in that it just goes through the steps without downloading any data. If you run the script it ends at a drop down box (or combo) that has 3 options “Historical”, “dividends” & “Stock Splits”. I have added a note to show here I need to access or select the “Dividend” option and then I would apply the selection.
Any thoughts greatly appreciated .
Mitch
tell application "System Events"
tell process "Safari"
--Open to Yahoo finance
tell application "Safari"
tell window 1
set current tab to (make new tab with properties {URL:"https://finance.yahoo.com"})
end tell
end tell
delay 4
--For purpose of this have set Stock symbol to GE
set value of text field 1 of group 1 of group 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1 to "GE"
delay 5
--Search for Data for Stock Symbol in box GE for this test
click button 1 of group 2 of group 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1
--Click on Historical Data
delay 5
click static text 1 of UI element 1 of group 9 of group 1 of group 8 of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1
delay 5
--Drop down date Field
click text field 1 of group 1 of group 2 of group 9 of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1
display dialog "Drop Down Box for Date Visible"
--Select last 5 years data
display dialog "Now Select option for 5 Years"
click static text 1 of group 7 of group 1 of group 2 of group 9 of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1
--Click on the Done Button
click button 1 of group 1 of group 2 of group 9 of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1
display dialog "Done button Clicked"
--Drop down Show field "Historical" "dividends Only" & "Stock Splits"
display dialog "Now Click Historical Prices"
--This opens the drop down/combo box
click static text 1 of group 1 of group 2 of group 2 of group 9 of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1
--This is where I want to select Dividends Only" by clicking or selecting and then using key code 36 for return
end tell
end tell