Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Element.php

class Element

Same name in this branch
  1. 11.1.x vendor/behat/mink/src/Element/Element.php \Behat\Mink\Element\Element
  2. 11.1.x core/lib/Drupal/Core/Config/Schema/Element.php \Drupal\Core\Config\Schema\Element
  3. 11.1.x core/lib/Drupal/Core/Render/Element.php \Drupal\Core\Render\Element
  4. 11.1.x core/modules/editor/src/Element.php \Drupal\editor\Element

WebDriver\Element class

@package WebDriver

@method string attribute($attributeName) Get the value of an element's attribute. @method void clear() Clear a TEXTAREA or text INPUT element's value. @method void click() Click on an element. @method string css($propertyName) Query the value of an element's computed CSS property. @method boolean displayed() Determine if an element is currently displayed. @method boolean enabled() Determine if an element is currently enabled. @method boolean equals($otherId) Test if two element IDs refer to the same DOM element. @method array location() Determine an element's location on the page. @method array location_in_view() Determine an element's location on the screen once it has been scrolled into view. @method string name() Query for an element's tag name. @method mixed property($propertyName) Get element property. @method array rect() Get element rect. @method array screenshot() Take element screenshot. @method boolean selected() Is element selected? @method array size() Determine an element's size in pixels. @method void submit() Submit a FORM element. @method string text() Returns the visible text for the element. @method void postValue($json) Send a sequence of key strokes to an element.

Hierarchy

  • class \WebDriver\AbstractWebDriver
    • class \WebDriver\Container extends \WebDriver\AbstractWebDriver
      • class \WebDriver\Element extends \WebDriver\Container

Expanded class hierarchy of Element

1 file declares its use of Element
Selenium2Driver.php in vendor/lullabot/mink-selenium2-driver/src/Selenium2Driver.php
18 string references to 'Element'
ckeditor5.data_types.yml in core/modules/ckeditor5/config/schema/ckeditor5.data_types.yml
core/modules/ckeditor5/config/schema/ckeditor5.data_types.yml
ckeditor5_filter_format_edit_form_submit in core/modules/ckeditor5/ckeditor5.module
Form submission handler for filter format forms.
ConfigTranslationHooks::theme in core/modules/config_translation/src/Hook/ConfigTranslationHooks.php
Implements hook_theme().
ElementInfoManager::__construct in core/lib/Drupal/Core/Render/ElementInfoManager.php
Constructs an ElementInfoManager object.
FieldUiHooks::theme in core/modules/field_ui/src/Hook/FieldUiHooks.php
Implements hook_theme().

... See full list

File

vendor/lullabot/php-webdriver/lib/WebDriver/Element.php, line 38

Namespace

WebDriver
View source
class Element extends Container {
    const WEB_ELEMENT_ID = 'element-6066-11e4-a52e-4f735466cecf';
    
    /**
     * Element ID
     *
     * @var string
     */
    private $id;
    
    /**
     * {@inheritdoc}
     */
    protected function methods() {
        return array(
            'attribute' => array(
                'GET',
            ),
            'clear' => array(
                'POST',
            ),
            'click' => array(
                'POST',
            ),
            'css' => array(
                'GET',
            ),
            'enabled' => array(
                'GET',
            ),
            'name' => array(
                'GET',
            ),
            'property' => array(
                'GET',
            ),
            'rect' => array(
                'GET',
            ),
            'screenshot' => array(
                'GET',
            ),
            'selected' => array(
                'GET',
            ),
            'text' => array(
                'GET',
            ),
            'value' => array(
                'POST',
            ),
            // Legacy JSON Wire Protocol
'displayed' => array(
                'GET',
            ),
            // @see https://w3c.github.io/webdriver/#element-displayedness
'equals' => array(
                'GET',
            ),
            'location' => array(
                'GET',
            ),
            'location_in_view' => array(
                'GET',
            ),
            'size' => array(
                'GET',
            ),
            'submit' => array(
                'POST',
            ),
        );
    }
    
    /**
     * {@inheritdoc}
     */
    protected function obsoleteMethods() {
        return array(
            'active' => array(
                'GET',
            ),
            'computedlabel' => array(
                'GET',
            ),
            'computedrole' => array(
                'GET',
            ),
            'drag' => array(
                'POST',
            ),
            'hover' => array(
                'POST',
            ),
            'selected' => array(
                'POST',
            ),
            'toggle' => array(
                'POST',
            ),
            'value' => array(
                'GET',
            ),
        );
    }
    
    /**
     * Constructor
     *
     * @param string $url URL
     * @param string $id  element ID
     */
    public function __construct($url, $id) {
        parent::__construct($url);
        $this->id = $id;
    }
    
    /**
     * Get element ID
     *
     * @return string
     */
    public function getID() {
        return $this->id;
    }
    
    /**
     * Get element shadow root: /session/:sessionId/element/:elementId/shadow
     *
     * shadow root method chaining, e.g.,
     * - $element->method()
     *
     * @return \WebDriver\Shadow|null
     *
     */
    public function shadow() {
        $result = $this->curl('POST', '/shadow');
        $value = $result['value'];
        if (array_key_exists(Shadow::SHADOW_ROOT_ID, (array) $value)) {
            $shadowRootReference = $value[Shadow::SHADOW_ROOT_ID];
            return new Shadow(preg_replace('/' . preg_quote('element/' . $this->id, '/') . '$/', '/', $this->url), $shadowRootReference);
        }
        return null;
    }
    
    /**
     * {@inheritdoc}
     */
    protected function getIdentifierPath($identifier) {
        return preg_replace('/' . preg_quote($this->id) . '$/', $identifier, $this->url);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AbstractWebDriver::$curlService private property Curl service
AbstractWebDriver::$transientOptions private property Transient options
AbstractWebDriver::$url protected property URL
AbstractWebDriver::assertSerializable private function Sanity check
AbstractWebDriver::curl protected function Curl request to webdriver server.
AbstractWebDriver::getCurlService public function Get curl service
AbstractWebDriver::getRequestMethod private function Get default HTTP request method for a given WebDriver command
AbstractWebDriver::getTransientOptions public function
AbstractWebDriver::getURL public function Returns URL to Selenium server
AbstractWebDriver::offsetGet private function Extract value from result
AbstractWebDriver::setCurlService public function Set curl service
AbstractWebDriver::setTransientOptions public function Set transient options
AbstractWebDriver::__toString public function Magic method which returns URL to Selenium server
Container::$strategies private property
Container::element public function Find element: /session/:sessionId/element (POST)
Find child element: /session/:sessionId/element/:id/element (POST)
Search for element on page, starting from the document root.
Container::elements public function Find elements: /session/:sessionId/elements (POST)
Find child elements: /session/:sessionId/element/:id/elements (POST)
Search for multiple elements on page, starting from the document root.
Container::locate public function Return JSON parameter for element / elements command
Container::makeElement protected function Factory method for elements
Container::parseArgs private function Parse arguments allowing either separate $using and $value parameters, or
as an array containing the JSON parameters
Container::__call public function Magic method that maps calls to class methods to execute WebDriver commands Overrides AbstractWebDriver::__call 1
Element::$id private property Element ID
Element::getID public function Get element ID
Element::getIdentifierPath protected function Get wire protocol URL for an identifier Overrides Container::getIdentifierPath
Element::methods protected function Return array of supported method names and corresponding HTTP request methods Overrides AbstractWebDriver::methods
Element::obsoleteMethods protected function Return array of obsolete method names and corresponding HTTP request methods Overrides AbstractWebDriver::obsoleteMethods
Element::shadow public function Get element shadow root: /session/:sessionId/element/:elementId/shadow
Element::WEB_ELEMENT_ID constant
Element::__construct public function Constructor Overrides Container::__construct

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal