Hi elstockly
That worked once I got the right element number “4” ,as you may have thought that produces a drop down box that needs a start and end date they have to be selected from calendars that appear when the drop down box is activated . Cannot write the dates one has to select. When was using GUI I selected the next 7 days.
So now I have to loop your solution to opening the drop down box then get the date selection. I do not know how to use xpath so I figured I would loop until I had the name of the box. That may be giving me work than I need absent xpath so if there is a link to that it would be appreciated .
thanks again for all the help this site is the best.
Peter
Irrelevant but this was how I got the dates suing GUI
on NewStocks()
log "In NewStocks"
set {TodaysDate, Date1, cnt, Cnt2, CheckSYM, GrpNo} to {day of (current date), "", 0, 0, "", 20}
tell application "System Events" to tell process "Safari"
--Open "All Filters" box so dates can be set
set RefEnd to UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window 1
repeat until CheckSYM is "Stocks"
set GrpNo to GrpNo + 1
try --Using "Stocks" as the button has a name and the filter button does not
set CheckSYM to get name of button 1 of group GrpNo of RefEnd
end try
delay 0.25
end repeat
delay 2
click button 2 of group GrpNo of RefEnd --"All Filters" icon.
delay 2 --Need find way to check the box "All Filters" is open
set CheckName to ""
repeat with cnt from 10 to 50
set CheckName to name of button cnt of group GrpNo of RefEnd --Ex Div Date
if CheckName is "Ex-div Date" then exit repeat
end repeat
click button cnt of group GrpNo of RefEnd --Ex Div Date
repeat with cnt from 175 to 250 --Open the From Calendar
try
click text field 1 of group cnt of group GrpNo of RefEnd --opens From calendar
exit repeat
end try
end repeat
--the "From" Date
repeat with Cnt3 from 20 to 45 --get major group no
try
set Date1 to value of static text 1 of group 1 of group 1 of group 9 of group Cnt3 of RefEnd --The Date
exit repeat
end try
end repeat
delay 2 --Added as next leg could stall
repeat until Date1 as number = TodaysDate as number --Data Starting to day
set Cnt2 to Cnt2 + 1
set Date1 to value of static text 1 of group Cnt2 of group 1 of group 9 of group Cnt3 of RefEnd --The Date
end repeat
click static text 1 of group Cnt2 of group 1 of group 9 of group Cnt3 of RefEnd --The Date
--The "To" date
click text field 2 of group cnt of group GrpNo of RefEnd --opens the "To" calendar
click static text 1 of group (Cnt2 + 7) of group 1 of group 9 of group Cnt3 of RefEnd -- "To" Date + 7 days
click button 2 of group GrpNo of RefEnd --Closes the Date box
delay 2
click button 50 of group GrpNo of RefEnd --Close the "ALL FILTERS" box
click UI element 25 of group GrpNo of RefEnd --Download Button
delay 5 --Give it time to download
end tell
end NewStocks