I'm trying to run a script using jenkins, I'm using pytest framework to write my tests, I try to configure my project I use the option execute shell and using this code:
#!/bin/bash
/Library/Python/2.7/site-packages/virtualenv venv --distribute
. venv/bin/activate
# try to run your script here
/Library/Python/2.7/site-packages/pytest -p no:cacheprovider /Users/sergio/testjenkins/test_google.py
and this is the script I'm trying to run:
from selenium import webdriver
class TestGoogleSearchTest:
driver = None
def setup(self):
# Create a new Firefox driver instance
self.driver = webdriver.Firefox(executable_path = '/usr/local/bin/geckodriver')
def teardown(self):
# Close the browser after running the tests
self.driver.quit()
def test_search(self):
# Trigger a Google Search
self.driver.get('http://www.google.com')
searchElement = self.driver.find_element_by_name('q')
searchElement.send_keys('6020 peaks')
searchElement.submit()
my problem is when I try to build my project I receive this error:
E selenium.common.exceptions.WebDriverException: Message: connection refused
/Users/sergio/.pyenv/versions/3.4.2/lib/python3.4/site-packages/selenium/webdriver/remote/errorhandler.py:194: WebDriverException
========================== 1 error in 106.06 seconds ===========================
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Not really sure what could be the problem.
Thanks in advance