например, задав текст ссылки, получить элемент "дырявая ссылка".
Я пробовал так:
$page = $this->getSession()->getPage();
$page->find('content', 'Italiano');
Но пишет:
Селектор "content" не зарегистрирован.
EDIT: после проверки ссылок из ответов everzet'а у меня получилось вот это:
$el = $page->find('named', array(
'content', $this->getMainContext()->getSession()->getSelectorsHandler()->xpathLiteral('Pound')));
$el->click();
но я получаю эту ошибку о click()
функции:
Когда я выбираю "Pound sterling" #.
MyFirm\FrontendBundle\Features\Context\CurrencyControllerContext::iChoose()
error:_click(_byXPath("(//html/./descendant-or-self::*[contains(normalize-space(.), 'Pound')])[1]")) TypeError: parent.tagName не определено ([объект HTMLHtmlElement], "A",1)@http://myfirm.localhost/s/spr/concat.js:3286 ([объект HTMLHtmlElement], "A")@http://myfirm.localhost/s/spr/concat.js:3762 ([объект HTMLHtmlElement])@http://myfirm.localhost/s/spr/concat.js:331 ([object HTMLHtmlElement],false,false,(void 0))@http://myfirm.localhost/s/spr/concat.js:708 ([объект HTMLHtmlElement])@http://myfirm.localhost/s/spr/concat.js:478 ()@http://myfirm.localhost/s/spr/concat.js:3016 ()@http://myfirm.localhost/s/spr/concat.js:3016 @http://myfirm.localhost/s/spr/concat.js:2822
href='/s/dyn/Log_getBrowserScript?href=null&n=3286'>Click for скрипт браузера
Это начало вывода var_dump($el)
:
object(Behat\Mink\Element\NodeElement)#438 (2) {
["xpath":"Behat\Mink\Element\NodeElement":private]=>
string(74) "(//html/./descendant-or-self::*[contains(normalize-space(.), 'Pound')])[1]"
А вывод $el->getTagName()
- 'html'.
Это потому, что я пытаюсь нажать на что-то, что не является элементом, а просто содержимым? В таком случае, есть ли способ получить элемент из содержимого?