1# Copyright 2023 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5from __future__ import annotations 6 7from typing import TYPE_CHECKING 8 9from selenium import webdriver 10from selenium.webdriver.chrome.options import Options as ChromeOptions 11from selenium.webdriver.chrome.service import Service as ChromeService 12 13from crossbench.browsers.attributes import BrowserAttributes 14from crossbench.browsers.chrome.helper import ChromePathMixin 15from crossbench.browsers.chromium.applescript import ChromiumAppleScript 16 17if TYPE_CHECKING: 18 from selenium.webdriver.chromium.webdriver import ChromiumDriver 19 20 21class ChromeAppleScript(ChromePathMixin, ChromiumAppleScript): 22 23 WEB_DRIVER_OPTIONS = ChromeOptions 24 WEB_DRIVER_SERVICE = ChromeService 25 26 @property 27 def attributes(self) -> BrowserAttributes: 28 return (BrowserAttributes.CHROME | BrowserAttributes.CHROMIUM_BASED 29 | BrowserAttributes.APPLESCRIPT) 30 31 def _create_driver(self, options: ChromeOptions, 32 service: ChromeService) -> ChromiumDriver: 33 return webdriver.Chrome(options=options, service=service) 34