I’m trying to run a selenium script in a bitbucket pipeline. I’ve tried both putting the chromedriver in the repo and using ChromeDriverManager, both have resulted in the respective errors:
FileNotFoundError: [Errno 2] No such file or directory: ‘chromedriver.exe’
selenium.common.exceptions.WebDriverException: Message: Service /root/.wdm/drivers/chromedriver/linux64/99.0.4844.51/chromedriver unexpectedly exited. Status code was: 127
The selenium script, bitbucket-pipelines.yml and chromedriver.exe files are in the same directory of the repo for the first error.
Below are my pipeline and selenium scripts:
pipeline:
- step:
name: Get latest versions of libraries
image: python:3.8.2
script:
- pip install selenium
- pip install beautifulsoup4
- pip install lxml
- pip install webdriver-manager
- python webscrape.py #selenium script
artifacts:
- latest_vers.json
selenium script:
if __name__ == '__main__':
# s = Service("chromedriver.exe")
# driver = webdriver.Chrome(service=s)
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.maximize_window()
driver.get("https://www.npmjs.com/")
...
What should I do?