Pop up blocker issue with webdriver firefox

675 views
Skip to first unread message

San Chiluka

unread,
May 3, 2011, 7:30:29 PM5/3/11
to webdriver
Hi All,

I got an issue with webdriver using firefox.
In my application I have a link where it displays some results in a
table in another popup window and am doing testing on the results
using xpath displayed in that popup.
I am able to get the popup window and the results from the webdriver
test. But when I try to get the table elements from the popup window
using xpath, it gives me no such element exception. The strange thing
I observed is that, when I see the page source from the pop up, it
didn't displayed any html code related to the results table. Below is
the html source code for popup.
<html><head><link class="component" rel="stylesheet" type="text/css"
href="/arc-webapp/a4j/s/3_2_2.GAorg/richfaces/renderkit/html/css/
basic_classes.xcss/DATB/eAELXT5DOhSIAQ%21sA18_">
<link class="component" rel="stylesheet" type="text/css" href="/arc-
webapp/a4j/s/3_2_2.GAorg/richfaces/renderkit/html/css/
extended_classes.xcss/DATB/eAELXT5DOhSIAQ%21sA18_">
<script type="text/
javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script>
<script type="text/javascript" src="/arc-webapp/a4j/g/3_2_2.GAorg/
richfaces/renderkit/html/scripts/skinning.js"></script>
<script>var _AdfWindowOpenError='A popup window blocker has been
detected in your browser. Popup blockers interfere with the operation
of this application. Please disable your popup blocker or allow popups
from this site.';</script>
<script src="/arc-webapp/adf/jsLibs/Common1_2_10.js"></script>
<script>document.onkeydown=_noReload;var _blockReload=1;function
_fixDialogTitle()
{window.document.title=window.frames[0].document.title};</script>
<title>ARC::</title>
</head>
<frameset title="Content" rows="100%,*" onload="_fixDialogTitle();
_sizeWin(window.frames[0],0,30,{W:1200,H:1200})"
onunload="_checkUnload(event);window.opener.setTimeout('ADFDialogReturn[0]
();',1)">
<frame title="Content" frameborder="0" noresize="noresize" src="/arc-
webapp/main/completionHistoryDetail.seam?_afPfm=3a571c31&amp;loc=en"
longdesc="#">
<noframes>Your browser does not support frames. Frames support is
required for this functionality</noframes>
</frameset>
</html>

I tried couple of config preferences in initializing my webdriver.
Below are the settings I tried.
if ("firefox".equals(driverType)) {
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("webdriver_accept_untrusted_certs", true);
profile.setPreference("privacy.popup.policy", 0);
profile.setPreference("dom.disable_open_during_load", false);
profile.setPreference("browser.frames.enabled", true);
//profile.setAcceptUntrustedCertificates(true);
profile.setPreference("privacy.popups.firstTime", true);
return new FirefoxDriver(profile);

Please help me how do I resolve this issue. I have been on this issue
for couple of hours, but no luck.
Thanks in advance.
And , here is my

Luke Inman-Semerau

unread,
May 4, 2011, 10:39:45 AM5/4/11
to webd...@googlegroups.com

-Luke

> --
> You received this message because you are subscribed to the Google
> Groups "webdriver" group.
> To post to this group, send email to webd...@googlegroups.com.
> To unsubscribe from this group, send email to webdriver+...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/webdriver?hl=en
> .
>

Luke Inman-Semerau

unread,
May 4, 2011, 10:41:18 AM5/4/11
to webd...@googlegroups.com
Looks like you have a framed page. You'll need to use
webdriver.switchTo() to the appropriate frame

-Luke

On May 3, 2011, at 4:30 PM, San Chiluka <san.c...@gmail.com> wrote:

San Chiluka

unread,
May 4, 2011, 11:55:40 AM5/4/11
to webdriver
Hi Luke,

Thanks for your reply.
I am already doing that switching to the new window/frame.
Then I am checking the elements with xpath.
String windowHandle = driver.getWindowHandle();
driver.findElement(By.id(FULL_HISTORY_ID)).click();
try {
Thread.sleep(10000);
}
catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//WebDriver newDriver = null;
Set<String> openWindows = driver.getWindowHandles();
for(String newHandle : openWindows) {
if(!newHandle.equals(windowHandle)) {
driver = driver.switchTo().window(newHandle);
System.out.println(driver.getCurrentUrl());
System.out.println(driver.getTitle());
System.out.println(driver.getPageSource());
//driver = driver.switchTo().frame(newHandle);
try {
Thread.sleep(10000);
}
catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
}
}
return new FullHistoryPage(driver);

I tried both window and frames for switching.
Then I am trying to find some elements in that new window, but it
throws no such element exception.

Thanks,
San

On May 4, 8:41 am, Luke Inman-Semerau <luke.seme...@gmail.com> wrote:
> Looks like you have a framed page. You'll need to use  
> webdriver.switchTo() to the appropriate frame
>
> -Luke
>

Luke Inman-Semerau

unread,
May 4, 2011, 12:40:36 PM5/4/11
to webd...@googlegroups.com
Your code only shows switching to the window... not to the frame.

Also could you provide the XPATH you are searching for and the html of the frame you are (should be) switching to?

San Chiluka

unread,
May 4, 2011, 7:35:48 PM5/4/11
to webdriver
Thanks for that. I added one more switchTo method call to the frame
after window.
Now it's working fine.

San

On May 4, 10:40 am, Luke Inman-Semerau <luke.seme...@gmail.com> wrote:
> Your code only shows switching to the window... not to the frame.
>
> Also could you provide the XPATH you are searching for and the html of the
> frame you are (should be) switching to?
>
Reply all
Reply to author
Forward
0 new messages