1
는 다음과 같은 여러 CSS 클래스와 함께 입력 필드가 말 :
<input class="form-control existing-user" value="Darth Darth Binks"/>
그리고 behat의를 당신은 CSS 클래스에 의해 입력 요소를 찾아 그 값을 찾고 싶다.
이
$field = $this->getPage()->findAllBy('css', 'form-control')[0]->getValue();
// $field is now "Darth Darth Binks"
이 질문
여기에 차이점은 무엇입니까
$field = $this->getPage()->findAll('css', 'existing-user')[0]->getValue();
// $field is now null
작동하지 않습니다 작동? 먼저 작성되지 않은 수업 중 하나를 찾으면 특별한 것을해야합니까?
[div 요소를 동일한 클래스 이름으로 반복하여 내용을 가져옵니다.] (http://www.inanzzz.com/index.php/post/vsok/iterate-div-elements-with-same-class-name-to - get-their-contents), [CSS 선택자로 ID 태그가있는 요소를 클릭하십시오] (http://www.inanzzz.com/index.php/post/2y0l/click-on-an-element-that -has-an-id-tag-with-css-selector), [ID가있는 요소의 콘텐츠 가져 오기] (http://www.inanzzz.com/index.php/post/97ju/get-the-content -of-given-element-with-id), [ID 태그를 가진 요소를 클릭하십시오] (http://www.inanzzz.com/index.php/post/pzxm/click-on-an-element- that-has-an-id-tag) – BentCoder