Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Cannot read property 'nodeType' of null #150

@vanderlee

Description

@vanderlee

I get the following error using the Zombie driver:

Error "Cannot read property 'nodeType' of null" while executing code: var node,
      refs = [],
      result = browser.xpath("\/\/html");

  while (node = result.iterateNext()) {
      if (node.nodeType !== 10) {
          pointers.push(node);
          refs.push(pointers.length - 1);
      }
  }
  stream.end(JSON.stringify(refs)); (Behat\Mink\Exception\DriverException)

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:

$page->find('css', '#username');
$page->find('css', '#password');

These fail:

$page->find('css', 'html');
$page->getHtml();

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)); to stream.end(JSON.stringify([])); or stream.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 in stream.end().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions