Not able to get Url or Title of Web page with embedded PDF - Selenium WebDriver

1,397 views
Skip to first unread message

Dina Dodin

unread,
Dec 12, 2013, 8:14:18 AM12/12/13
to seleniu...@googlegroups.com

Hi,

 

In my application I’m clicking on some link and it is openeing a PDF file embedded in the browser(new window/Tab).

I’m using getCurrentURL to fetch the url value for validation once switching to the PDF window.

 

In chrome and FF it is working prefectly, but on IE it is not working.

 

For all the functions I used on the new window with the embedded PDF:

getCurrentUrl

geTitle

getPageSource

 

I was getting empty values in IE.

 

I have aslo tried using JavascriptExecutor but got exception: Java script error (again same worked on FF and Chrome)

 

Did anyone faced same/similar  issue?

 

IE8

FF 17.02

Selenium 2.35

 

Thanks Dina.

David

unread,
Dec 12, 2013, 8:32:28 PM12/12/13
to seleniu...@googlegroups.com
Perhaps it is likely how IE does the embedding...wonder if it matter what PDF plugin is used to load the PDF too. I'm guessing you have the default Adobe PDF reader that is most common (there are others).

Do you really need to support this for IE? If it works in 2 out of 3 browsers for automation, I would think that is good enough. It's not likely that you'd have problem on the IE side for server sending the PDF to IE, except for any plugin loading issues.

Eliyas Kumar

unread,
Feb 27, 2014, 9:05:56 AM2/27/14
to seleniu...@googlegroups.com
Hi,
I've tried with the below code for the same scenario u faced.It's not working for me even in chrome & firefox

public void testUntitled() throws Exception {
driver.get(baseUrl + "/english/investments/iv_funds.htm");
Set<String> winids = driver.getWindowHandles();
Iterator<String> iterate = winids.iterator();

Thread.sleep(3000);
driver.findElement(By.linkText("FUND MATERIALS")).click();
Thread.sleep(3000);

driver.findElement(By.className("sbToggle")).click();
Thread.sleep(3000);
driver.findElement(By.linkText("Fund Details and Performance Update")).click();
driver.findElement(By.id("fundPerformance")).click();
driver.findElement(By.id("fundPerformance")).clear();
driver.findElement(By.id("fundPerformance")).sendKeys("AEGAU");
Thread.sleep(3000);
driver.findElement(By.xpath("//*[@id='perform']")).click();
Thread.sleep(18000);
winids = driver.getWindowHandles();
iterate = winids.iterator();
String firstwindow=iterate.next();
String secondwindow = iterate.next();
System.out.println(firstwindow);
System.out.println(secondwindow);
driver.switchTo().window(secondwindow);
Thread.sleep(3000);

System.out.println("url is"+driver.getCurrentUrl());
driver.close();

 }

Thanks,

Eliyas Praveen

Reply all
Reply to author
Forward
0 new messages