I'v forgotten how to find a tab by its name and return the value (e.g tab 2) and eventually set the tab as the active tab too.
I've tried the following, but it's not working:
set titleString to "
"
tell application "Google Chrome"
set window_list to every window # get the windows
repeat with the_window in window_list # for every window
set tab_list to every tab in the_window # get the tabs
repeat with the_tab in tab_list # for every tab
set the_title to the title of the_tab # grab the title
if the_tab contains (Name to search" as text) then
display notification "the_tab"
end if
return # concatenate
end repeat
end repeat
end tell
I also tried to start something with JavaScript:
tell application "Google Chrome"
set window_list to every window
repeat with the_window in window_list
set tab_list to every tab in the_window
tell tab_list to set TheTab to execute javascript "document.title"
end repeat
end tell
But then I get:
{«class CrTb» id 4 of window id 1 of application "Google Chrome", «class CrTb» id 9 of window id 1 of application "Google Chrome", «class CrTb» id 2 of window id 1 of application "Google Chrome", «class CrTb» id 189 of window id 1 of application "Google Chrome"} doesn’t understand the “execute” message.
How can I proceed?