0

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

user964503
  • 91
  • 1
  • 13
  • This may help you https://stackoverflow.com/questions/39547598/selenium-common-exceptions-webdriverexception-message-connection-refused – Buaban Oct 05 '17 at 05:44
  • thanks for your answer but doesn't seem the same error, the geckodriver has this error: 2017-10-05 09:47:04.236 firefox-bin[51594:3535212] kCFURLVolumeIsAutomountedKey missing for file://localhost/private/var/folders/x7/hbpgtz5d5m5580f70vr609d00000gn/T/AppTranslocation/08FF51A1-9498-445C-9061-C71A4B165F31/: The file “08FF51A1-9498-445C-9061-C71A4B165F31” couldn’t be opened because you don’t have permission to view it. _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL. – user964503 Oct 05 '17 at 19:31

0 Answers0