tools/mac/power/driver.py
def RunScenario(self, scenario_config):
    """Start the browser and initiate the scenario

    Args:
      scenario_config: A dictionary describing the scenario.

    Returns: A psutil.process representation the driver script process.
    """

    scenario_browser = scenario_config["browser"]

    if scenario_browser is not None:
      browser_executable = utils.get_browser_property(scenario_browser,
                                                      'executable')
      if scenario_browser in ["Chromium", "Chrome", "Canary", "Edge"]:
        subprocess.call(["open", "-a", browser_executable, "--args"] +
                        ["--enable-benchmarking", "--disable-stack-profiler"] +
                        scenario_config["extra_args"])
      elif scenario_browser == "Safari":
        subprocess.call(["open", "-a", browser_executable])
        # Call prep_safari.scpt to make sure the run starts clean. See file
        # comment for details.
        subprocess.call(["osascript", './driver_scripts/prep_safari.scpt'])
        subprocess.call(["open", "-a", browser_executable, "--args"] +
                        scenario_config["extra_args"])

    # Wait for the browser to be started and ready for AppleScript commands.
    if scenario_browser:
      browser_process_name = utils.get_browser_property(scenario_browser,
                                                        'process_name')
      browser_process = None
      while not browser_process:
        browser_process = self.FindBrowserProcess(scenario_config["browser"])
        time.sleep(0.100)
        logging.info(f"Waiting for {browser_process_name} to start")

    self._started_processeds.append(browser_process)

    driver_script_args = [
        "osascript", f'./driver_scripts/{scenario_config["driver_script"]}.scpt'
    ]
    process = subprocess.Popen(driver_script_args)

    return process
Start the browser and initiate the scenario

    Args:
      scenario_config: A dictionary describing the scenario.

    Returns: A psutil.process representation the driver script process.
    
Start the browser and initiate the scenario
Start the browser and initiate the scenario
def RunScenario(self, scenario_config):
    scenario_browser = scenario_config["browser"]
    if scenario_browser is not None:
      browser_executable = utils.get_browser_property(scenario_browser,
                                                      'executable')
      if scenario_browser in ["Chromium", "Chrome", "Canary", "Edge"]:
        subprocess.call(["open", "-a", browser_executable, "--args"] +
                        ["--enable-benchmarking", "--disable-stack-profiler"] +
                        scenario_config["extra_args"])
      elif scenario_browser == "Safari":
        subprocess.call(["open", "-a", browser_executable])
        subprocess.call(["osascript", './driver_scripts/prep_safari.scpt'])
        subprocess.call(["open", "-a", browser_executable, "--args"] +
                        scenario_config["extra_args"])
    if scenario_browser:
      browser_process_name = utils.get_browser_property(scenario_browser,
                                                        'process_name')
      browser_process = None
      while not browser_process:
        browser_process = self.FindBrowserProcess(scenario_config["browser"])
        time.sleep(0.100)
        logging.info(f"Waiting for {browser_process_name} to start")
    self._started_processeds.append(browser_process)
    driver_script_args = [
        "osascript", f'./driver_scripts/{scenario_config["driver_script"]}.scpt'
    ]
    process = subprocess.Popen(driver_script_args)
    return process
def RunScenario ( self , scenario_config ) : scenario_browser = scenario_config [ "browser" ] if scenario_browser is not None : browser_executable = utils . get_browser_property ( scenario_browser , 'executable' ) if scenario_browser in [ "Chromium" , "Chrome" , "Canary" , "Edge" ] : subprocess . call ( [ "open" , "-a" , browser_executable , "--args" ] + [ "--enable-benchmarking" , "--disable-stack-profiler" ] + scenario_config [ "extra_args" ] ) elif scenario_browser == "Safari" : subprocess . call ( [ "open" , "-a" , browser_executable ] ) subprocess . call ( [ "osascript" , './driver_scripts/prep_safari.scpt' ] ) subprocess . call ( [ "open" , "-a" , browser_executable , "--args" ] + scenario_config [ "extra_args" ] ) if scenario_browser : browser_process_name = utils . get_browser_property ( scenario_browser , 'process_name' ) browser_process = None while not browser_process : browser_process = self . FindBrowserProcess ( scenario_config [ "browser" ] ) time . sleep ( 0.100 ) logging . info ( f"Waiting for {browser_process_name} to start" ) self . _started_processeds . append ( browser_process ) driver_script_args = [ "osascript" , f'./driver_scripts/{scenario_config["driver_script"]}.scpt' ] process = subprocess . Popen ( driver_script_args ) return process
Start the browser and initiate the scenario
Start the browser and initiate the scenario
"""Start the browser and initiate the scenario

    Args:
      scenario_config: A dictionary describing the scenario.

    Returns: A psutil.process representation the driver script process.
    """ # Call prep_safari.scpt to make sure the run starts clean. See file # comment for details. # Wait for the browser to be started and ready for AppleScript commands.
self
scenario_config
A dictionary describing the scenario.
A dictionary describing the scenario .