'Gitlab CI got error selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH when I running my simple pro

I'm just learning selenium using python in gitlab CI, i wanna try to run my simple project, but i got error "Message: 'chromedriver' executable needs to be in PATH".

this is my python script :

import unittest
from selenium import webdriver

    class GoogleTestCase(unittest.TestCase):
     
        def setUp(self):
            self.browser = webdriver.Chrome()
            self.addCleanup(self.browser.quit)
    
        def testPageTitle(self):
            self.browser.get('http://www.google.com')
            self.assertIn('Google', self.browser.title)
    
    if __name__ == '__main__':
        unittest.main(verbosity=2)

and this is my .gitlab-ci.yml script

image: "python:3.7" run_test:   services:
    - selenium/standalone-chrome   before_script:
    - python -V
    - python3 -m pip install pytest
    - python3 -m pip install selenium pytest
    - python3 -m pip install webdriver_manager
    - python3 -m pip install allure-pytest   script:
    - python test_sele_python.py   tags:
    - python3-alpine

when i run the pipeline a got error :

enter image description here

can anyone help me?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source