Installing Chrome browser on an Agent

Vladimir Varbanov 0 Reputation points
2025-02-24T10:18:44.6+00:00

Hello there,

I'm trying to run my unit tests with Chrome headless and I need to the install Google Chrome on an Azure agent. I'm wondering how can I do that. I tried a few founds over the net:

like this,

also with:


steps:

# Install Google Chrome on the virtual machine

- powershell: |

    $chromeInstaller = "chrome_installer.exe"

    Invoke-WebRequest -Uri "https://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile $chromeInstaller

    Start-Process -FilePath $chromeInstaller -ArgumentList "/silent", "/install" -NoNewWindow -Wait

    Remove-Item -Path $chromeInstaller

  displayName: 'Install Google Chrome'

and also with chocolatey, but I'm constantly getting errors.

My question is:

is there a convinient way to install google chrome browser before other dependencies of my project?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,018 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-03-03T11:42:14.6333333+00:00

    Hi Vladimir Varbanov,

    This another way to install chrome agent using the YAML FILE

    To install the Chrome Azure Agent, follow these steps:

    • Navigate to the Azure DevOps Marketplace and download the latest Agent.
    • Extract the Agent and run the configuration script (config.cmd or config.sh depending on your OS).
    • Register the Agent with your Azure DevOps organization and configure the pool.

    To configure the Chrome Azure Agent, you need to enable the Chrome Headless mode in your pipeline. Follow these steps:

    Create or update your YAML pipeline file and include the --no-sandbox and --headless flags.

    <code>
         steps:
           - task: ChromeHeadless@1
             inputs:
               chromeVersion: 'latest'
               enableSandbox: true
               headless: true
           - script: npm run test:chromium </script>
    

    If you found the information useful, please accept the answer on the post to let us know. 

    Thank You.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.