Circle ci 2 Config.yml Problem for selenium


#1

Hello,

Can someone help me configure my config.yml Please. I have a screenshot.

My Circle result. and My config.yml


#2

So we can understand the problem, please edit your post in these ways:

  • copy and paste your log output in text format (use the code formatting tool for readability)
  • copy and paste your config (use the code formatting tool again)

You can additionally supply images if it is helpful, but I don’t think it is necessary in this case.

Read this article to understand why readers prefer text artefacts to be supplied as text.


#3

Hello halfer,

Thank you for the reply. Also, Im sorry for my late reply. Here is the code.

CircleCi Error:

Exit code: 1
#!/bin/bash -eo pipefail
python Tommy_SmokeTest.py
Traceback (most recent call last):
  File "Tommy_SmokeTest.py", line 2, in <module>
    from selenium import webdriver
ModuleNotFoundError: No module named 'selenium'
Exited with code 1

For my Config.yml code:

  build:
    docker:
      # specify the version you desire here
      # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
      - image: circleci/python:3.6.1
      
      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/postgres:9.4

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "requirements.txt" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip install -r requirements.txt

      - save_cache:
          paths:
            - ./venv
          key: v1-dependencies-{{ checksum "requirements.txt" }}
        
      # run tests!
      # this example uses Django's built-in test-runner
      # other common Python testing frameworks include pytest and nose
      # https://pytest.org
      # https://nose.readthedocs.io
      - run: python Tommy_SmokeTest.py

Thank You! Hope you can help me with this. Hoping for your reply.

Respectfully,
Emman


#4

OK, great. I don’t use Python, but a few things come to mind:

  • Check that the module you want is in your requirements.txt
  • Make sure that python points to the installation of Python you actually want (and that has the dependencies). I would suggest adding a run step before the tests of python -v to ensure you’re not calling Python 2, for example
  • You could also get an SSH session and try a locate python and locate python3 to see if it would be worth hardwiring a path
  • Lastly try taking out the restore_cache and save_cache sections, in case they are not properly installing your dependencies