Reputation: 36189
I'm trying to reload all tabs of Chrome (i could have many windows open) of a certain page. This is what I did:
tell application "Google Chrome"
set {ids} to every window
repeat with id in ids
reload (tabs of window id whose URL contains "mypage.com")
end repeat
end tell
But I get Google Chrome got an error: Can’t make item 1 of window id 1 into type integer.
How do I do this?
Upvotes: 3
Views: 791
Reputation: 6092
The answer submitted by @wch1zpink won't work if there are any Chrome windows open that don't contain at least one tab with a mypage.com
URL. Unfortunately, you need to iterate through the windows:
tell application "Google Chrome" to repeat with W in windows
reload (every tab in W whose URL contains "mypage.com")
end repeat
Upvotes: 2
Reputation: 3142
This works for me using the latest version of macOS Mojave and Chrome.
tell application "Google Chrome" to set allTabs to a reference to (tabs of windows whose URL contains "mypage.com")
tell application "Google Chrome" to reload allTabs
Upvotes: 0