Checks that an attribute of a specific elements contains text.

@param string       $selectorType
@param string|array $selector
@param string       $attribute
@param string       $text

@throws ElementHtmlException
484925
public function elementAttributeContains($selectorType, $selector, $attribute, $text)
    {
        $element = $this->elementAttributeExists($selectorType, $selector, $attribute);
        $actual = $element->getAttribute($attribute);
        $regex = '/'.preg_quote($text, '/').'/ui';

        $message = sprintf(
            'The text "%s" was not found in the attribute "%s" of the %s.',
            $text,
            $attribute,
            $this->getMatchingElementRepresentation($selectorType, $selector)
        );

        $this->assertElement((bool) preg_match($regex, $actual), $message, $element);
    }
101587
public boolean contains(Attribute attr) throws NamingException {
    if (attr == null) {
      return false; // protect
    }

    Attribute recAttr = getAttributes().get(attr.getID());

    if (recAttr == null) {
      return false;
    }

    NamingEnumeration ne = attr.getAll();

    while (ne.hasMore()) {
      if (!recAttr.contains(ne.next())) {
        return false;
      }
    }

    return true;
  }
118310
public function td(string $text = '', array $attributes = []): void
    {
        $this->tdArray[] = Tags::td($text, $attributes);
    }
550720
private function evaluateElmType($elmType, $selectedConditions, $attribute, $selectedValues, $valueName, &$response)
    {
        if ($elmType == 'select' or $selectedConditions == 'null') {
            $isEmpty = false;

            if ($selectedConditions == 'null') {
                $isEmpty = true;
            }

            $valueOptions = $this->ruleValue->getValueSelectOptions($attribute, $isEmpty);

            $response['cvalue'] = str_replace(
                'value="' . $selectedValues . '"',
                'value="' . $selectedValues . '"' . 'selected="selected"',
                $this->getOptionHtml('cvalue', $valueName, $valueOptions)
            );
        } elseif ($elmType == 'text') {
            $encodedValue = $this->escaper->escapeHtml($selectedValues);
            $html = "<input style='width:160px' title='cvalue' name='$valueName' value='$encodedValue'/>";
            $response['cvalue'] = $html;
        }
    }
923691
function querySelector(selector) {
    init();
    if (!selector) {
      return tokens;
    }
    var match = selector.match(
      /^\s*([\w_-]*)((\s*\[[\w_-]+\s*=\s*("([^\\"]*(\\.)*)*"|'([^\\']*(\\.)*)*'|[^\[\]]*)\])*)\s*(\*?)$/
    );
    if (!match) {
      console.warn(colors.blue('Invalid selector expressions %j.'), selector);
      return;
    }
    var tag = match[1];
    var attributes = [];
    var all = match[9] === '*';
    match[2].replace(/\s*\[([\w_-]+)\s*=\s*("([^\\"]*(\\.)*)*"|'([^\\']*(\\.)*)*'|[^\[\]]*)\]/g,
      function (match, name, value) {
        if (/^['"]/.test(value)) {
          /*jslint evil: true */
          value = new Function('return (' + value + ');')();
        }
        attributes.push({
          name: name,
          value: value
        });
      }
    );
    function check(node) {
      if (!node || !node.attrs) {
        return;
      }
      var flag;
      if (!tag || node.tag === tag) {
        flag = true;
        attributes.every(function (item) {
          if (item.value !== node.attrs[item.name]) {
            flag = false;
          }
          return flag;
        });
      }
      return flag;
    }
    var items;
    function scan(node) {
      if (check(node)) {
        if (items) {
          items.push(node);
        }
        return node;
      }
      var result;
      if (node.nodes) {
        node.nodes.every(function (item) {
          result = scan(item);
          return items || !result;
        });
      }
      return result;
    }
    if (all) {
      items = [];
      scan(tokens);
      return items;
    }
    else {
      return scan(tokens);
    }
  }
632221
public function assertMatchesSelector($selector, DOMElement $element, $message = '')
    {
        return PHPUnit_Framework_Assert::assertThat($element, $this->matchesSelector($selector), $message);
    }
10736
protected function ensure_element_exists($element, $selectortype) {

        // Getting the behat selector & locator.
        list($selector, $locator) = $this->transform_selector($selectortype, $element);

        // Exception if it timesout and the element is still there.
        $msg = 'The "' . $element . '" element does not exist and should exist';
        $exception = new ExpectationException($msg, $this->getSession());

        // It will stop spinning once the find() method returns true.
        $this->spin(
            function($context, $args) {
                // We don't use behat_base::find as it is already spinning.
                if ($context->getSession()->getPage()->find($args['selector'], $args['locator'])) {
                    return true;
                }
                return false;
            },
            array('selector' => $selector, 'locator' => $locator),
            self::get_extended_timeout(),
            $exception,
            true
        );

    }
28677
@Then("^the element on index '(\\d+?)' has '(.+?)' as text$")
    public void assertSeleniumTextOnElementPresent(Integer index, String text) {
        assertThat(commonspec.getPreviousWebElements()).as("There are less found elements than required")
                .hasAtLeast(index);
        String elementText = commonspec.getPreviousWebElements().getPreviousWebElements().get(index).getText().replace("\n", " ").replace("\r", " ");
        if (!elementText.startsWith("regex:")) {
            //We are verifying that a web element contains a string
            assertThat(elementText.matches("(.*)" + text + "(.*)")).isTrue();
        } else {
            //We are verifying that a web element contains a regex
            assertThat(elementText.matches(text.substring(text.indexOf("regex:") + 6, text.length()))).isTrue();
        }
    }
834829
public function hasRuleBySelector( $selector ){
		foreach( $this->rules as $rule )
			if( $selector == $rule->getSelector() )
				return TRUE;
		return FALSE;
	}
1371848
public function grabAttributeFromXmlElement($cssOrXPath, $attribute)
    {
        $el = (new XmlStructure($this->connectionModule->_getResponseContent()))->matchElement($cssOrXPath);
        if (!$el->hasAttribute($attribute)) {
            $this->fail("Attribute not found in element matched by '$cssOrXPath'");
        }
        return $el->getAttribute($attribute);
    }
779696
function elementMatches (el, selector) {
  if (el.matches) { return el.matches(selector) }
  if (el.msMatchesSelector) { return el.msMatchesSelector(selector) }
  if (el.webkitMatchesSelector) { return el.webkitMatchesSelector(selector) }
}
179894
public void startElement(String elemName, Attributes attrs) {
        writeStartElement(elemName, attrs);
        m_tagStack.push(elemName);
    }
409502
private <E> boolean isBindable(Bindable<?> attribute, Class<E> elementType)
    {
        return attribute != null && attribute.getBindableJavaType().equals(elementType);
    }
194000
@When("^I type '(.+?)' on the element on index '(\\d+?)'$")
    public void seleniumType(@Transform(NullableStringConverter.class) String text, Integer index) {
        assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required")
                .hasAtLeast(index);
        while (text.length() > 0) {
            Actions actions = new Actions(commonspec.getDriver());
            if (-1 == text.indexOf("\\n")) {
                actions.moveToElement(commonspec.getPreviousWebElements().getPreviousWebElements().get(index));
                actions.click();
                actions.sendKeys(text);
                actions.build().perform();
                text = "";
            } else {
                actions.moveToElement(commonspec.getPreviousWebElements().getPreviousWebElements().get(index));
                actions.click();
                actions.sendKeys(text.substring(0, text.indexOf("\\n")));
                actions.build().perform();
                text = text.substring(text.indexOf("\\n") + 2);
            }
        }
    }
926877
function find(el, selector) {
  if (!selector) {
    selector = el;
    el = document;
  }
  return el.querySelector(selector);
}
378821
public function check($xpath) {
    $this->inputCheckableControl($xpath);
    $javascript = $this->javascriptTemplateRender("check_element.js.twig", array("xpath" => $xpath, "check" => "true"));
    $this->browser->evaluate($javascript);
  }
144918
function(selector) {
			var texts = 'textarea, input:not([type=checkbox]):not([type=radio])';
			var field = gui.DOMPlugin.qdoc(selector);
			if(field && field !== document.activeElement) {
				field.focus();
				if (gui.CSSPlugin.matches(field, texts)) {
					field.setSelectionRange(
						field.value.length,
						field.value.length
					);
				}
			}
		}