pytest-dev / pytest-splinter

pytest splinter and selenium integration for anyone interested in browser interaction in tests
MIT License
254 stars 51 forks source link

Ghostdriver issue #12

Closed bh closed 10 years ago

bh commented 10 years ago

After upgrading from 1.0.3 -> 1.1.0, I get the following issue, when using PhantomJS:

mx/webapp/tests/acceptance/test_foo.py:34: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_bdd/scenario.py:168: in _execute_scenario
    _execute_step_function(request, feature, step, step_func, example=example)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_bdd/scenario.py:123: in _execute_step_function
    step_func(**kwargs)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_bdd/steps.py:146: in <lambda>
    step_func = lambda request: request.getfuncargvalue(func.__name__)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1337: in getfuncargvalue
    return self._get_active_fixturedef(argname).cached_result[0]
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1351: in _get_active_fixturedef
    result = self._getfuncargvalue(fixturedef)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1403: in _getfuncargvalue
    val = fixturedef.execute(request=subrequest)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1820: in execute
    fixturedef = request._get_active_fixturedef(argname)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1351: in _get_active_fixturedef
    result = self._getfuncargvalue(fixturedef)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1403: in _getfuncargvalue
    val = fixturedef.execute(request=subrequest)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1853: in execute
    self.yieldctx)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1779: in call_fixture_func
    res = fixturefunc(**kwargs)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_splinter/plugin.py:274: in browser
    return browser_instance_getter(browser)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_splinter/plugin.py:251: in prepare_browser
    browser = browser_pool[browser_key] = get_browser()
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_splinter/plugin.py:232: in get_browser
    visit_condition_timeout=splinter_browser_load_timeout, **copy.deepcopy(kwargs)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_splinter/plugin.py:27: in __init__
    self.browser = splinter.Browser(*args, **kwargs)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/splinter/browser.py:53: in Browser
    return driver(*args, **kwargs)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/splinter/driver/webdriver/phantomjs.py:28: in __init__
    self.driver = PhantomJS(desired_capabilities=capabilities, **kwargs)
/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/selenium/webdriver/phantomjs/webdriver.py:50: in __init__
    self.service.start()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.phantomjs.service.Service object at 0x7f47ab8c5470>

    def start(self):
        """
            Starts PhantomJS with GhostDriver.

            :Exceptions:
             - WebDriverException : Raised either when it can't start the service
               or when it can't connect to the service
            """
        try:
            self.process = subprocess.Popen(self.service_args, stdin=subprocess.PIPE,
                                            close_fds=platform.system() != 'Windows',
                                            stdout=self._log, stderr=self._log)

        except Exception as e:
            raise WebDriverException("Unable to start phantomjs with ghostdriver.", e)
        count = 0
        while not utils.is_connectable(self.port):
            count += 1
            time.sleep(1)
            if count == 30:
>                raise WebDriverException("Can not connect to GhostDriver")
E                selenium.common.exceptions.WebDriverException: Message: 'Can not connect to GhostDriver'
bubenkoff commented 10 years ago

please ensure that it's because of the upgrade please install the older version and check if it solves the problem

On 9 September 2014 15:51, Benjamin Hedrich notifications@github.com wrote:

After upgrading from 1.0.3 -> 1.1.0, I get the following issue, when using PhantomJS:

mx/webapp/tests/acceptance/test_foo.py:34:


/home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_bdd/scenario.py:168: in _execute_scenario _execute_step_function(request, feature, step, step_func, example=example) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_bdd/scenario.py:123: in _execute_step_function step_func(kwargs) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_bdd/steps.py:146: in step_func = lambda request: request.getfuncargvalue(func.name) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1337: in getfuncargvalue return self._get_active_fixturedef(argname).cached_result[0] /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1351: in _get_active_fixturedef result = self._getfuncargvalue(fixturedef) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1403: in _getfuncargvalue val = fixturedef.execute(request=subrequest) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1820: in execute fixturedef = request._get_active_fixturedef(argname) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1351: in _get_active_fixturedef result = self._getfuncargvalue(fixturedef) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1403: in _getfuncargvalue val = fixturedef.execute(request=subrequest) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1853: in execute self.yieldctx) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/_pytest/python.py:1779: in call_fixture_func res = fixturefunc(_kwargs) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_splinter/plugin.py:274: in browser return browser_instance_getter(browser) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_splinter/plugin.py:251: in prepare_browser browser = browser_pool[browser_key] = get_browser() /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_splinter/plugin.py:232: in get_browser visit_condition_timeout=splinter_browser_load_timeout, _copy.deepcopy(kwargs) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/pytest_splinter/plugin.py:27: in init self.browser = splinter.Browser(_args, _kwargs) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/splinter/browser.py:53: in Browser return driver(_args, _kwargs) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/splinter/driver/webdriver/phantomjs.py:28: in init self.driver = PhantomJS(desired_capabilities=capabilities, kwargs) /home/bhe/.virtualenvs/mx-py34/lib/python3.4/site-packages/selenium/webdriver/phantomjs/webdriver.py:50: in init self.service.start()


self = <selenium.webdriver.phantomjs.service.Service object at 0x7f47ab8c5470>

def start(self):
    """
        Starts PhantomJS with GhostDriver.

        :Exceptions:
         - WebDriverException : Raised either when it can't start the service
           or when it can't connect to the service
        """
    try:
        self.process = subprocess.Popen(self.service_args, stdin=subprocess.PIPE,
                                        close_fds=platform.system() != 'Windows',
                                        stdout=self._log, stderr=self._log)

    except Exception as e:
        raise WebDriverException("Unable to start phantomjs with ghostdriver.", e)
    count = 0
    while not utils.is_connectable(self.port):
        count += 1
        time.sleep(1)
        if count == 30:
           raise WebDriverException("Can not connect to GhostDriver")

E selenium.common.exceptions.WebDriverException: Message: 'Can not connect to GhostDriver'

— Reply to this email directly or view it on GitHub https://github.com/paylogic/pytest-splinter/issues/12.

Anatoly Bubenkov

bh commented 10 years ago

1.0.3 works fine.

bubenkoff commented 10 years ago

checking now

On 9 September 2014 16:00, Benjamin Hedrich notifications@github.com wrote:

1.0.3 works fine.

— Reply to this email directly or view it on GitHub https://github.com/paylogic/pytest-splinter/issues/12#issuecomment-54972842 .

Anatoly Bubenkov

paylogic-mergekeepers commented 10 years ago

i cannot reproduce this issue, unfortunately pytest==2.6.1 pytest-bdd==2.3.1 pytest-cache==1.0 pytest-contextfixture==0.1.1 pytest-cov==1.6 pytest-instafail==0.1.1 pytest-pep8==1.0.5 pytest-splinter==1.1.0 pytest-xdist==1.10

selenium==2.42.1

phantomjs --version 1.9.7

lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04 LTS Release: 14.04 Codename: trusty

works with np

On 9 September 2014 16:08, Anatoly Bubenkov notifications@github.com wrote:

checking now

On 9 September 2014 16:00, Benjamin Hedrich notifications@github.com wrote:

1.0.3 works fine.

— Reply to this email directly or view it on GitHub < https://github.com/paylogic/pytest-splinter/issues/12#issuecomment-54972842>

.

Anatoly Bubenkov

— Reply to this email directly or view it on GitHub https://github.com/paylogic/pytest-splinter/issues/12#issuecomment-54973929 .

Anatoly Bubenkov

Senior Software Engineer at Core team

E anatoly.bubenkov@paylogic.nl

M +31(0)6 19999803

T +31(0)88 7000 100

W http://www.paylogic.nl/www.paylogic.nl

paylogic-mergekeepers commented 10 years ago

python is much older than yours, but should not matter...

On 9 September 2014 16:19, Anatoly Bubenkov anatoly.bubenkov@paylogic.nl wrote:

i cannot reproduce this issue, unfortunately pytest==2.6.1 pytest-bdd==2.3.1 pytest-cache==1.0 pytest-contextfixture==0.1.1 pytest-cov==1.6 pytest-instafail==0.1.1 pytest-pep8==1.0.5 pytest-splinter==1.1.0 pytest-xdist==1.10

selenium==2.42.1

phantomjs --version 1.9.7

lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04 LTS Release: 14.04 Codename: trusty

works with np

On 9 September 2014 16:08, Anatoly Bubenkov notifications@github.com wrote:

checking now

On 9 September 2014 16:00, Benjamin Hedrich notifications@github.com wrote:

1.0.3 works fine.

— Reply to this email directly or view it on GitHub < https://github.com/paylogic/pytest-splinter/issues/12#issuecomment-54972842>

.

Anatoly Bubenkov

— Reply to this email directly or view it on GitHub https://github.com/paylogic/pytest-splinter/issues/12#issuecomment-54973929 .

Anatoly Bubenkov

Senior Software Engineer at Core team

E anatoly.bubenkov@paylogic.nl

M +31(0)6 19999803

T +31(0)88 7000 100

W http://www.paylogic.nl/www.paylogic.nl

Anatoly Bubenkov

Senior Software Engineer at Core team

E anatoly.bubenkov@paylogic.nl

M +31(0)6 19999803

T +31(0)88 7000 100

W http://www.paylogic.nl/www.paylogic.nl

bh commented 10 years ago

$ pip freeze | grep -e pytest -e selenium pytest==2.6.1 pytest-bdd==2.3.2 pytest-cov==1.7.0 pytest-django==2.6.2 pytest-ipdb==0.1-prerelease pytest-rerunfailures==0.05 pytest-splinter==1.1.0 pytest-xdist==1.10 selenium==2.42.1

$ phantomjs --version 1.9.7

$ python -V Python 3.4.1

Arch Linux x86_64 current

bubenkoff commented 10 years ago

and splinter's version?

On 9 September 2014 16:25, Benjamin Hedrich notifications@github.com wrote:

$ pip freeze | grep -e pytest -e selenium pytest==2.6.1 pytest-bdd==2.3.2 pytest-cov==1.7.0 pytest-django==2.6.2 pytest-ipdb==0.1-prerelease pytest-rerunfailures==0.05 pytest-splinter==1.1.0 pytest-xdist==1.10 selenium==2.42.1

$ phantomjs --version 1.9.7

$ python -V Python 3.4.1

Arch Linux x86_64 current

— Reply to this email directly or view it on GitHub https://github.com/paylogic/pytest-splinter/issues/12#issuecomment-54976570 .

Anatoly Bubenkov

bh commented 10 years ago

$ pip freeze | grep splinter
pytest-splinter==1.1.0 splinter==0.6.0

paylogic-mergekeepers commented 10 years ago

try to do this

override this fixure

@pytest.fixture def splinter_driver_kwargs(): return {'_service_logpath': '/tmp/phantomjs.log'}

run your test and then look into the log

On 9 September 2014 16:20, Anatoly Bubenkov anatoly.bubenkov@paylogic.nl wrote:

python is much older than yours, but should not matter...

On 9 September 2014 16:19, Anatoly Bubenkov anatoly.bubenkov@paylogic.nl wrote:

i cannot reproduce this issue, unfortunately pytest==2.6.1 pytest-bdd==2.3.1 pytest-cache==1.0 pytest-contextfixture==0.1.1 pytest-cov==1.6 pytest-instafail==0.1.1 pytest-pep8==1.0.5 pytest-splinter==1.1.0 pytest-xdist==1.10

selenium==2.42.1

phantomjs --version 1.9.7

lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04 LTS Release: 14.04 Codename: trusty

works with np

On 9 September 2014 16:08, Anatoly Bubenkov notifications@github.com wrote:

checking now

On 9 September 2014 16:00, Benjamin Hedrich notifications@github.com wrote:

1.0.3 works fine.

— Reply to this email directly or view it on GitHub < https://github.com/paylogic/pytest-splinter/issues/12#issuecomment-54972842>

.

Anatoly Bubenkov

— Reply to this email directly or view it on GitHub https://github.com/paylogic/pytest-splinter/issues/12#issuecomment-54973929 .

Anatoly Bubenkov

Senior Software Engineer at Core team

E anatoly.bubenkov@paylogic.nl

M +31(0)6 19999803

T +31(0)88 7000 100

W http://www.paylogic.nl/www.paylogic.nl

Anatoly Bubenkov

Senior Software Engineer at Core team

E anatoly.bubenkov@paylogic.nl

M +31(0)6 19999803

T +31(0)88 7000 100

W http://www.paylogic.nl/www.paylogic.nl

Anatoly Bubenkov

Senior Software Engineer at Core team

E anatoly.bubenkov@paylogic.nl

M +31(0)6 19999803

T +31(0)88 7000 100

W http://www.paylogic.nl/www.paylogic.nl

bh commented 10 years ago

$ pip freeze | grep -e pytest -e selenium -e splinter
pytest==2.6.2 pytest-bdd==2.3.2 pytest-cov==1.7.0 pytest-django==2.6.2 pytest-ipdb==0.1-prerelease pytest-rerunfailures==0.05 pytest-splinter==1.1.0 pytest-xdist==1.10 selenium==2.43.0 splinter==0.6.0

Works fine :+1: :dancers: Thank you!

bubenkoff commented 10 years ago

so the reason was selenium, i guess

On 10 September 2014 16:26, Benjamin Hedrich notifications@github.com wrote:

$ pip freeze | grep -e pytest -e selenium -e splinter

pytest==2.6.2 pytest-bdd==2.3.2 pytest-cov==1.7.0 pytest-django==2.6.2 pytest-ipdb==0.1-prerelease pytest-rerunfailures==0.05 pytest-splinter==1.1.0 pytest-xdist==1.10 selenium==2.43.0 splinter==0.6.0

Works fine [image: :+1:][image: :dancers:] Thank you!

— Reply to this email directly or view it on GitHub https://github.com/paylogic/pytest-splinter/issues/12#issuecomment-55122611 .

Anatoly Bubenkov