ie driver automating acrobat pdf viewer

38 views
Skip to first unread message

Achyuth Pydmarri

unread,
Dec 27, 2017, 1:45:21 AM12/27/17
to webdriver
Hello All,

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 and the new window is not getting detected.

with IE driver, do we have any limitations with PDF viewing ?
why is the new window not getting detected

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

Reply all
Reply to author
Forward
0 new messages