Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mink + Zombie Driver: Error while processing click and clickLink #145

Closed
LogansUA opened this issue Dec 8, 2015 · 4 comments
Closed

Mink + Zombie Driver: Error while processing click and clickLink #145

LogansUA opened this issue Dec 8, 2015 · 4 comments

Comments

@LogansUA
Copy link

LogansUA commented Dec 8, 2015

Hello everyone.
I'm trying to do some thing using custom symfony console command.
In console command i starting zombie session like in example:

/**
 * Start session
 */
public function startSession()
{
    $host = '127.0.0.1';
    $port = '8124';
    $node = '/home/oleg/.nvm/versions/io.js/v3.3.1/bin/iojs';

    $this->mink = new Mink([
        'zombie' => new Session(new ZombieDriver(new ZombieServer($host, $port, $node))),
    ]);

    $this->mink->setDefaultSessionName('zombie');
    $this->mink->getSession();
}

After that, i'm getting session and trying to execute some scenarios:

// Get session
$session = $this->scenarioService->getMink()->getSession('zombie');

// Scenario
$session->visit($site->getUrl());
$session->getPage()->clickLink('Some text');

HTML link view:

<li id="item-id">
     <a href="/some/specific/url?with=params">Some text</a>
</li>

And there come's error's:
Sometimes getting this:

[Behat\Mink\Exception\DriverException]                                                                                                                                        
  Error while processing event 'click': "Error: Timeout: did not get to load all resources on this page
    at timeout (/usr/local/lib/node_modules/zombie/lib/eventloop.js:601:38)
    at Timer.listOnTimeout (timers.js:89:15)" 

And sometimes getting that:

[Behat\Mink\Exception\DriverException]                                                                                                                                        
  Error while processing event 'click': "TypeError: Cannot set property 'aborted' of null
    at XMLHttpRequest.abort (/usr/local/lib/node_modules/zombie/lib/xhr.js:57:23)
    at XMLHttpRequest.open (/usr/local/lib/node_modules/zombie/lib/xhr.js:74:12)
    at f (https://url.to.some.site/static/js/vendor/respond.min.js:6:748)
    at x (https://url.to.some.site/static/js/vendor/respond.min.js:6:3845)
    at Window.<anonymous> (https://url.to.some.site/static/js/vendor/respond.min.js:6:3923)
    at Window.window._evaluate (/usr/local/lib/node_modules/zombie/lib/document.js:253:155)
    at /usr/local/lib/node_modules/zombie/lib/eventloop.js:77:35
    at Immediate._onImmediate (/usr/local/lib/node_modules/zombie/lib/eventloop.js:676:13)
    at processImmediate [as _immediateCallback] (timers.js:371:17)" 

I have installed:

behat/mink-zombie-driver: ^1.3
behat/mink: ^1.7
iojs: v3.3.1
zombie: v4.2.1

Someone know what to do with this? 😄

@stof
Copy link
Member

stof commented Dec 8, 2015

this looks like errors in Zombie itself, so I suggest reporting them to zombie directly.

@joelwurtz
Copy link

This happens when the page load by the click takes more than 5 seconds to load (including assets like image / css / js)

We also got this issue because of a slow dependency.

However zombie supports an option when creating the browser to have a longer Timeout if needed: waitDuration.

AFAIK there is more options than timeout, maybe it would be nice to handle them when creating the browser instance in ZombieServer ?

Reference of options : https://github.com/assaf/zombie/blob/master/src/index.js#L30

@aik099
Copy link
Member

aik099 commented Jan 19, 2016

I see no problem in adding support for Zombie options on Server class (see https://github.com/minkphp/MinkZombieDriver/blob/master/src/NodeJS/Server.php#L73) by adding 7th constructor parameter. Then these options can be passed directly to created browser instances.

Unfortunately this alone won't make Behat users happier, because the MinkExtension part responsible for integration with Zombie needs to be updated as well so that zombie options can be specified via .behat.yml file.

Please send these PR's then (or at least one of them).

@aik099
Copy link
Member

aik099 commented Jul 3, 2016

Closing in favor of #154, where setting for zombie options is added.

@aik099 aik099 closed this as completed Jul 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants