Hello.
I need to get whole content of an iframe using selenium API in java. I want to have access of all content of the incidents in trial version of Remedy.
This is the expected result, what I see in the browser:
<div id="WIN_0_304255502" arid="304255502" artype="View" ardbn="z2VF_02"
arcontainerid="304255802" arpercentwidth="100"
arpercentheight="100" class="arfid304255502 ardbnz2VF_02"
ardcf="1" style="top: auto; left: auto; width: 1318px;
height: 744px; z-index: 1135; min-width: 20px;
max-width: 32767px; min-height: 20px;
max-height: 32767px; position: relative; overflow: hidden;
background-color: transparent;"
arvfframe="<iframe style="top:0px&#59; left:0px&#59; width:1170px&#59;
height:744px&#59;
background-color: transparent&#59;" name="VF304255502" frameborder=0
scrolling="no"
allowtransparency="true" arviewbordercolor="null"title="z2VF_02"src="javascript:&quot;&lt;HTML&gt;&lt;/HTML&gt;&quot;"
onload="DVFol&#40;&#41;">
</iframe>
" arwindowid="0" arstop="1">
//more elements
WebDriver driver= new HtmlUnitDriver();
driver.get(url3);
saveFile(driver.getPageSource());
After run the program, the result that I have it´s not what I expected. Maybe because of iframe that exists.
Result:
<div id="WIN_0_304255502" arid="304255502" artype="View" ardbn="z2VF_02"arcontainerid="304255802"
arpercentwidth="100" arpercentheight="100" class="arfid304255502 ardbnz2VF_02"
ardcf="1" style="top:0px; left:0px; width:1170px; height:744px;z-index:1135;background-color:transparent;min-width:20px;max-width:32767px;min-height:20px;max-height:32767px;"
arvfframe="<iframe style="top:0px&#59; left:0px&#59; width:1170px&#59;
height:744px&#59;background-color: transparent&#59;"name="VF304255502"
frameborder=0 scrolling="no" allowtransparency="true"arviewbordercolor="null"
title="z2VF_02"src="javascript:&quot;&lt;HTML&gt;&lt;/HTML&gt;&quot;"
onload="DVFol&#40;&#41;">
</iframe>
">
</div>
I also try to access iframe, with the name dynamically (driver.switchTo().frame(driver.findElement(By.name(nameIframe)), but occurs an exception (org.openqa.selenium.NoSuchElementException: Unable to locate element with name: VF304255503).
Thanks.
VF304255502"
. Just try with that name.driver.switchTo().frame(driver.findElement(By.name(nameIframe))
WIN_0_304255502
']/iframe[@name='"+nameIframe+"']")))