Open vanderlee opened 8 years ago
Are you using IO.JS to run Zombie?
The Zombie 4.x+ require IO.JS to work and would crash with strange errors when executed on NodeJS.
If you're running IO.JS, then please post:
Also try using Zombie 3 and report if that works in there.
I'm using the current stable Node.js, v4.2.4.
The HTML is the same as https://test.iconneqt.nl/admin/index.php, except on localhost
Will try to post a PHP example when I can get to the code (it's part of a much larger testing framework, so it might take a while to extract it). There is nothing much going on though; just loading an URI, getting the page, a few .find()
statements on ID's, then the .getHtml()
that fails.
On the Node 5.4.1 and Zombie 4.2.1 the following snippet works fine for me:
$session = $this->getSession();
$session->visit('https://test.iconneqt.nl/admin/index.php');
$page = $session->getPage();
echo $page->getHtml();
Due the nature of implementation of getHtml
method for Zombie )the .innerHTML
is returned) and therefore it doesn't contain the <html>
node itself and it's attributes.
$page->find('css', 'html');
This won't find any elements, because $page
itself has //html
xpath and therefore attempting to find tag with html
name in it builds up//html/html
selector which finds nothing.
@vanderlee , any update?
$node->getHtml()
returns the inner HTML for all drivers. This is why we have getOuterHTML
Same problem hier.
please provide a reproducing case (best way is to build it as a testcase in the driver testsuite, but this is not required as long as the reproducing case is self-contained to allow us to include it in the testsuite)
I got the same problem when the base_url was http://localhost and no web server was running on localhost.
It seems that when you get an empty response, this error is triggered when you try to do $page->getHtml();
It took me forever to find out what was wrong, because this bug masked what was my real issue.
Hello @stof, the application is running in a docker container that is behind a nginx proxy that is also another docker container.
There is some problems to use zombie in this environment, but I can not see the problem read property 'nodeType' of null
anymore. I made some changes and right now I am having others issues. In this way, I can not reproduce the problem I said.
I am still studying how to setup the our features tests correctly. If I continue with problems, I will post the details here or in a new issue.
Thank you!
And the error happens in browser.xpath("\/\/html")
The while loop below it never gets executed, that is a red herring.
For me, the problem also occurred using the method xpath
, but with a more complex string parameter when I used the When I press "my-button"
step (from behat/mink-extension
).
@TerjeBr, did you check if the page was correctly loaded? I use the step Then print last response
to check if the request made by zombie
worked.
No, my page was not loaded at all, because the local web-server was not running.
But I could not see that because it was masked by this error.
I get the following error using the Zombie driver:
Using Zombie 4.2.1 and Mink 1.7.0 with zombie-driver 1.3.0. I also tried Zombie 4.0.13 to check if this was a regression, but both versiions give the same error.
The weird thing is, it only happens for a specific .find() statement: These works fine:
These fail:
These all worked just fine using the Goutte driver.
I tried changing the javascript a bit to find the problem, but I can't find it.
If I change the line
stream.end(JSON.stringify(refs));
tostream.end(JSON.stringify([]));
orstream.end('[]');
, I no longer get this error. I get an error that there are no matches, but that's to be expected. Seems like the problem is instream.end()
.