3

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&amp;lettername=Billing 
Notice&amp;docId=383437&amp;loginId=XXXX&amp;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
testerBDD
  • 255
  • 3
  • 18
  • Possible duplicate of [Best way to keep track of Windows with Selenium in IE11?](https://stackoverflow.com/questions/46251494/best-way-to-keep-track-of-windows-with-selenium-in-ie11) – undetected Selenium Dec 13 '17 at 05:15
  • as subject says, main question is that pdf is not getting loaded while using iedriver, but pdf gets loaded with chrome driver & by manually executing it. – testerBDD Dec 13 '17 at 05:23
  • What do you mean by `pdf is not loaded`? Doesn't the pdf opens in a new window? Your `window_handling` is not proper thats why `new window is not getting detected` – undetected Selenium Dec 13 '17 at 05:29
  • the new window is blank and with no content, as stated before with chrome and manually it does load PDF. Can you let me know what is wrong with window_handling – testerBDD Dec 13 '17 at 05:33
  • i have updated html code from the application, hope this will help – testerBDD Dec 14 '17 at 05:04
  • Can you show me the capabilities the IEDriverServer is configured with? – undetected Selenium Dec 14 '17 at 06:20
  • DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT); capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); System.setProperty("webdriver.ie.driver", "C:/IEDriverServer.exe"); driver = new InternetExplorerDriver(capabilities); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); – testerBDD Dec 14 '17 at 07:37

0 Answers0