I have a button in IE, when clicked on the button it opens a new window with a pdf file in it.
while using IE webdriver, pdf is not loaded on the new window, the new window is blank and doesnt have any content. It works well with Chrome-driver and also manually on IE The new window also doesnt get detected with selenium
with IE driver, do we have any limitations with PDF viewing ?
html code
<INPUT class="ui-button ui-widget ui-state-default ui-corner-all"
id=previewLetter role=button aria-disabled=false style="WIDTH: 150px"
onclick="Javascript:ns_7_P8LL6OA610SGF0ADUCO96E3004_launchXpressions
('postform','preview_letter','/zawps/CR')" type=button
value="Preview Letter" jQuery15108424594360553599="13">
<FRAMESET rows=100%><FRAME
src="/wps/PA_onCR/LetterPreViewServlet?
NAVIGATION_PARAMETER=preview_letter&lettername=Billing
Notice&docId=383437&loginId=XXXX&version=16.0"></FRAMESET>
i am trying to use below code
String parentHandle = DriverFactory.getDriver().getWindowHandle(); // get the current window handle
Set<String> winHandles = DriverFactory.getDriver().getWindowHandles();
int numberOfWindows = winHandles.size();
DriverFactory.getDriver().findElement(By.xpath("//input[@value='Preview Letter']")).click();
System.out.println("2 : number of windows are" + winHandles.size());
System.out.println("2 : the title of page is" + DriverFactory.getDriver().getTitle());
System.out.println("2 : the title of page is" + DriverFactory.getDriver().getCurrentUrl());
for (String winHandle : DriverFactory.getDriver().getWindowHandles()) {
DriverFactory.getDriver().switchTo().window(winHandle); // switch focus of WebDriver to the next found window handle (that's your newly opened window)
}
System.out.println("3 : number of windows are" + winHandles.size());
System.out.println("3 : the title of page is" + DriverFactory.getDriver().getTitle());
System.out.println("3 : the title of page is" + DriverFactory.getDriver().getCurrentUrl());
//code to do something on new window
DriverFactory.getDriver().close(); // close newly opened window when done with it
DriverFactory.getDriver().switchTo().window(parentHandle); // switch back to the original window