Bird
0
0

You added this Jenkins Pipeline step to run Selenium tests:

medium📝 Troubleshoot Q14 of 15
Selenium Python - CI/CD Integration
You added this Jenkins Pipeline step to run Selenium tests:
sh 'python3 -m selenium test_suite.py'

But the build fails with "No module named selenium" error. What is the likely fix?
AUse <code>sh 'selenium test_suite.py'</code> instead
BChange command to <code>python3 selenium test_suite.py</code>
CRemove <code>-m</code> from the command
DAdd a step to install selenium with <code>pip install selenium</code> before running tests
Step-by-Step Solution
Solution:
  1. Step 1: Understand error cause

    "No module named selenium" means Python can't find the selenium package installed.
  2. Step 2: Fix by installing selenium

    Adding pip install selenium before running tests ensures the package is available.
  3. Final Answer:

    Add a step to install selenium with pip install selenium before running tests -> Option D
  4. Quick Check:

    Missing package error = install package first [OK]
Quick Trick: Install missing Python packages before running tests [OK]
Common Mistakes:
  • Changing command syntax without installing package
  • Removing -m which is unrelated here
  • Trying to run selenium as a command

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes