chromium/tools/mac/power/driver_scripts_templates/safari_meet

{%- from 'macros' import hash_bang with context -%}
{%- from 'macros' import make_maximized with context -%}
{{ hash_bang() }}

-- Copyright 2021 The Chromium Authors
-- Use of this source code is governed by a BSD-style license that can be
-- found in the LICENSE file.

-- For behavior description see meet file. Differs from the generic template
-- because for Safari Javascript is invoked differently and tabs are accessed
-- differently.

set myURL to "https://meet.google.com/{{ meeting_id }}"

tell application "Safari"
  -- If Safari is already started then just bring
  -- it to the forefront otherwise open it.
  if it is running then
    reopen
  else
    activate
  end if

  {{ make_maximized() }}

  open location {myURL}
  tell document 1
    repeat while document 1's source = ""
      delay 0.5
    end repeat

    do JavaScript "b=document.getElementsByClassName('uArJ5e UQuaGc Y5sE8d uyXBBb xKiqt')[0];b.click();"
  end tell

  delay {{ delay }}
end tell