public function getElementId()
    {
        if ($this->elementId === null) {
            $param = WebDriver_Util::parseLocator($this->locator);
            $commandUri = (null === $this->parent) ? 'element' : "element/{$this->parent->getElementId()}/element";
            $command = $this->driver->factoryCommand($commandUri, WebDriver_Command::METHOD_POST, $param);
            try {
                $result = $this->driver->curl($command);
            } catch (WebDriver_Exception $e) {
                $parentText = (null === $this->parent) ? '' : " (parent: {$this->parent->getLocator()})";
                $e->setMessage("Element not found: {$this->locator}{$parentText}  with error: {$e->getMessage()}");
                throw $e;
            }
            if (!isset($result['value']['ELEMENT'])) {
                $parentText = (null === $this->parent) ? '' : " (parent: {$this->parent->getLocator()})";
                throw new WebDriver_Exception("Element not found: {$this->locator}{$parentText}");
            }
            $this->elementId = $result['value']['ELEMENT'];
        }
        return $this->elementId;
    }