Beispiel #1
0
 public function testGetOuterHtml()
 {
     $expected = 'val1';
     $node = new NodeElement('text_tag', $this->session);
     $this->driver->expects($this->once())->method('getOuterHtml')->with('text_tag')->will($this->returnValue($expected));
     $this->assertEquals($expected, $node->getOuterHtml());
 }
 /**
  * Ensure that checkbox/radio button is checked.
  */
 public function checkable()
 {
     $this->restrictElements(['input' => ['radio', 'checkbox']]);
     if (!in_array($this->element->getAttribute('type'), ['radio', 'checkbox'])) {
         throw new \RuntimeException('Element cannot be checked.');
     }
     self::debug(['%s'], [$this->element->getOuterHtml()]);
     $this->assert($this->element->isChecked(), 'checked');
 }
Beispiel #3
0
 /**
  * @param $node
  */
 public static function parseAttribs(NodeElement $node)
 {
     $tagName = $node->getTagName();
     $outer = $node->getOuterHtml();
     $dom = new \DOMDocument();
     $dom->loadHTML('<?xml encoding="UTF-8">' . $outer);
     $sxe = simplexml_import_dom($dom);
     /** @var \SimpleXMLElement $tag */
     $tag = $sxe->body->{$tagName};
     $a = (array) $tag->attributes();
     $attributes = $a['@attributes'];
     return $attributes;
 }