2012-09-10 5 views
3

누군가 내가 잘못하고있는 것을 정확하게 지적 할 수 있는지 궁금합니다. Android WebDriver를 사용하여 iframe에 액세스하려고합니다. 홈 페이지의 로그인 링크를 클릭하면 iframe이 열립니다. 아래는 내가 switchTo을 내가 iframe이가 열립니다까지, 프레임 ID가 존재하는지 확인 기다릴Android WebDriver를 사용하여 IFrame으로 전환 할 수 없습니다.

<div class="dialog" style="background-color: rgb(232, 235, 238); color: rgb(51, 51, 51);"> 
    <iframe id="registration-dialog-frame" scrolling="no" frameborder="0" src="http://test.com" border="0" allowtransparency="true" style="width: 235px;"> 
    <html> 
    </iframe> 
<span id="signin-cancel" class="cancelButton">Cancel</span> 

을 만들어 액세스하고 사용하는 것을 시도하고있다 iframe이 ID를 가지고있는 SRC 코드 중 일부이다() 나는 할 때 나는

org.openqa.selenium.WebDriverException: Error: {"message":"Cannot read property 'document' of undefined"} 

를 얻을이

driver.switchTo().frame("registration-dialog-frame"); 

처럼 그 iframe을로 전환 이

driver.switchTo().frame(driver.findElement(By.id("registration-dialog-frame"))); 

내가 얻을

org.openqa.selenium.WebDriverException: java.util.ArrayList cannot be cast to org.openqa.selenium.android.library.DomWindow 

이것은 안드로이드 WebDriver 것입니까? iframe으로 전환 할 때 다른 유사한 오류가 발생 했습니까? 아무도 내가 이것을 어떻게 할 수 있는지 안다?

답변

0

코드를보고 해당 페이지에있는 프레임 수를 확인하고 색인을 사용하여 아래 표시된 것처럼 특정 프레임으로 전환하십시오.

driver.switchTo().frame(frameindex); 

예 : 첫 번째 프레임으로 전환하려면 다음 줄을 사용하십시오.

driver.switchTo().frame(0); 
관련 문제