Returns DomQuery with immediately following sibling of all nodes

@param string|self|callable|\DOMNodeList|\DOMNode|null $selector expression that filters the set of matched elements

@return self
972460
public function next($selector=null)
    {
        $result = $this->createChildInstance();

        if (isset($this->document) && $this->length > 0) {
            foreach ($this->nodes as $node) {
                if ($next = self::getNextElement($node)) {
                    $result->addDomNode($next);
                }
            }

            if ($selector) {
                $result = $result->filter($selector);
            }
        }

        return $result;
    }
398123
public function element(string $selector): ?Element
    {
        $element = $this->resolver->find($selector);
        return self::convertElement($element, $this->driver);
    }
232436
public static function toXPath($selector)
    {
        if (isset(self::$compiled[$selector])){
            return self::$compiled[$selector];
        }

        // Select DOMText
        if ($selector === 'text') {
            return '//text()';
        }

        // Select DOMComment
        if ($selector === 'comment') {
            return '//comment()';
        }

        if (!class_exists('Symfony\\Component\\CssSelector\\CssSelectorConverter')) {
            throw new \RuntimeException('Unable to filter with a CSS selector as the Symfony CssSelector 2.8+ is not installed (you can use filterXPath instead).');
        }

        $converter = new CssSelectorConverter(true);

        $xPathQuery = $converter->toXPath($selector);
        self::$compiled[$selector] = $xPathQuery;

        return $xPathQuery;
    }
1246321
public function remove($selector=null)
    {
        $result = $this;
        if ($selector) {
            $result = $result->filter($selector);
        }
        foreach ($result->nodes as $node) {
            if ($node->parentNode) {
                $node->parentNode->removeChild($node);
            }
        }

        $result->nodes = array();
        $result->length = 0;

        return $result;
    }
511376
public function prependTo($selector): self {
        if ($selector instanceof \DOMNode || $selector instanceof NodeList) {
            $nodes = $this->inputAsNodeList($selector);
        } else {
            $nodes = $this->document()->find($selector);
        }

        $nodes->prepend($this);

        return $this;
    }
399804
function(selector) {
        var el = this.el.querySelector(selector);
        if (el && el.parentElement !== this.el) {
            el = null;
        }
        return el;
    }
417999
public function selector2xpath($selector)
    {
        $parts = preg_split('/\\s+/', $selector);
        $xpath = "";
        foreach ($parts as $part) {
            if (preg_match('/^([A-Za-z][A-Za-z0-9]*)/', $part, $matches)) {
                $xpath .= "//$matches[1]";
            } else {
                $xpath .= "//*";
            }
            $xfilters = array();
            if (preg_match('/#([^#.\[]+)/', $part, $matches)) {
                $xfilters[] = "@id='$matches[1]'";
            }
            if (preg_match('/\.([^#.\[]+)/', $part, $matches)) {
                $xfilters[] = "contains(@class,'$matches[1]')";
            }
            if ($xfilters) {
                $xpath .= '[' . implode(',', $xfilters) . ']';
            }
        }
        return $xpath;
    }
1270877
public function parserCommonTable($body, $selector = '#DataGrid1')
    {
        $crawler = new Crawler((string)$body);

        $crawler = $crawler->filter($selector);
        $cet = $crawler->children();
        $data = $cet->each(function (Crawler $node, $i) {
            return $node->children()->each(function (Crawler $node, $j) {
                return $node->text();
            });
        });
        //Unset the title.
        unset($data[0]);
        return $data;
    }
775742
public function filter($selector)
    {
        $converter = $this->createCssSelectorConverter();

        // The CssSelector already prefixes the selector with descendant-or-self::
        return $this->filterRelativeXPath($converter->toXPath($selector));
    }
908780
public function precedingUntil($input = null, $selector = null): NodeList {
        return $this->_walkPathUntil('previousSibling', $input, $selector);
    }
729872
public function find($selector, $nth = null)
    {
        $this->isLoaded();

        return $this->root->find($selector, $nth);
    }
438839
public function parent(string $selector = "*"): ?Element
    {
        if ($selector === "*") {
            $prefix = "parent";
        } else {
            $prefix = "ancestor";
        }

        $selector = preg_replace("/\.([a-zA-Z0-9_-]+)/", "[contains(@class, '$1')]", $selector);

        return $this->findElement(WebDriverBy::xpath("{$prefix}::{$selector}"));
    }
1005127
public function click(string $selector = null): Element
    {
        if ($selector === null) {
            $element = $this->remote;
        } else {
            $element = $this->resolver->findOrFail($selector);
        }

        $element->click();

        return $this;
    }
1088478
public function last($selector=null)
    {
        $result = $this[$this->length-1];
        if ($selector) {
            $result = $result->filter($selector);
        }
        return $result;
    }
364734
public function parent($selector = null) {
        $results = $this->_walkPathUntil('parentNode', null, $selector, self::$MATCH_TYPE_FIRST);

        return $this->result($results);
    }
1161369
protected function getTable($selector) {
        $selector = $this->getSession()->getSelectorsHandler()->xpathLiteral($selector);
        $page = $this->getSession()->getPage();
        $candidates = $page->findAll(
            'xpath',
            $this->getSession()->getSelectorsHandler()->selectorToXpath(
                "xpath", ".//table[(./@id = $selector or  contains(./@title, $selector))]"
            )
        );

        // Find tables by a <caption> field
		$candidates += $page->findAll('xpath', "//table//caption[contains(normalize-space(string(.)), 
			$selector)]/ancestor-or-self::table[1]");

        // Find tables by a .title node
		$candidates += $page->findAll('xpath', "//table//*[@class='title' and contains(normalize-space(string(.)), 
			$selector)]/ancestor-or-self::table[1]");

        // Some tables don't have a visible title, so look for a fieldset with data-name instead
        $candidates += $page->findAll('xpath', "//fieldset[@data-name=$selector]//table");

        assertTrue((bool)$candidates, 'Could not find any table elements');

        $table = null;
        foreach($candidates as $candidate) {
            if(!$table && $candidate->isVisible()) {
                $table = $candidate;
            }
        }

        assertTrue((bool)$table, 'Found table elements, but none are visible');

        return $table;
    }
122887
public function setSelector( $selector )
    {
        $this->selector = empty( $selector )
            ? self::SELECTOR_ALL
            : (string) $selector;

        $matches = array();

        if ( empty( $this->rootParagraphId ) &&
             preg_match( '/#paragraph-(\d+)/', $selector, $matches ) )
        {
            $this->setRootParagraphId( $matches[1] );
        }

        return $this;
    }