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}"));
    }
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}"));
    }
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}" ) ) ; }
Get one of the parents of this element.

@param string $selector

@return ?Element
Get one of the parents of this element .