iframe 내부의 텍스트/메시지를 이름/ID로 확인해야합니다. 탐구 후, 그 해결책을 찾아 id/name을 추가하고 switchToIFrame (id/name)을 사용합니다. 밍크의 노드 요소에 id/name을 어떻게 설정합니까? SetAttribute()는 nodelement에서 지원되는 메서드가 아니며 setValue()는 프레임에서 지원되지 않습니다.ID/이름이없는 밍크/behat iframe
<html>
<body>
<div class="div1">
<iframe class="xyz">
<!DOCTYPE html>
<html>
<body>
<div class="frame"></div>
<p>The paragraph1</p>
</body>
</html>
</body>
</html>
내 상황에 맞는 파일은 iframe을 자바 스크립트를 사용하는 것입니다에 ID/이름을 설정하기 위해 무엇을 할 수 있는지
public function iShouldSeeDescription($arg1)
{
$expected = "The paragraph1";
$iframe=$this->getSession()->getPage()->find ('xpath', '//div[contains(@class,"div1")]/iframe[contains(@class,"xyz")]');
$iframe->setAttribute('id', 'iframe_id');
$iframeId = $iframe->getAttribute('id');
$this->getSession()->switchToIframe("$iframeId");
$actual = $this->getSession()->getPage()->find('xpath', '//div[@class="frame"]/p[1]');
if ($actual === null) {
throw new \InvalidArgumentException (sprintf ('null:%s', $arg1));
}
if (!($actual === $expected)) {
throw new \InvalidArgumentException (sprintf ('The Acutal description:%s and expected description:%s did not match ', $actual, $expected));
}
}
나는 이것이 테스트를위한 방법 일 뿐이고 iframe으로 전환하고 유효성 검사가 다른 단계 여야하며 예상 텍스트와이 텍스트를 포함하는 선택자가 metod의 매개 변수 여야한다고 가정합니다. – lauda