문제

Selenium web-driver script, when running on Firefox, presents no problems. But on IE, it cannot find any elements.

It is a pop-up window. On IE 9, F12 is useless, but I use driver.getPageSource (from Selenium) and it finds no elements on this page.

The contents of the page are shown below. How can I deal with this kind of page?

<HTML><HEAD><TITLE>Search Results</TITLE>
<SCRIPT>
function doLoad()
{
pkRootIframe.location.href="/iBuilderBRC_Test/searchPrivateClientSetup.do?org.apache.struts.taglib.html.TOKEN=76de45c614fdba60bd0c3ebdd0e9a5f0&indicesSearch=false&surname=AAA&forname=BBB&countryCode=&addressLine(HNNO)=&addressLine(STRN)=&addressLine(PSTI)=&clientType=&daytimePhoneNumber=&dateOfBirthDay=&dateOfBirthMonth=&dateOfBirthYear=&claimsSearch=false&queryOnlyForNonStandardClients=true" ;
}
</SCRIPT>
</HEAD>
<BODY onload=doLoad() tabIndex=-1><IFRAME id=pkRootIframe height="100%"src="/iBuilderBRC_Test/pleaseWait.do" width="100%"></IFRAME></BODY></HTML>
도움이 되었습니까?

해결책

There's an iframe in the IE version of the page. You'll need to switch into the iframe using switchTo().frame(). An example:

driver.switchTo().frame("pkRootIframe");

Once you're finished in the iframe, you can switch back to the top level of the document by using:

driver.switchTo().defaultContent();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top