views:

574

answers:

3

Hi all

When selenium tries to open popup window I'm getting JS error permission denied in file file:///C:/DOCUME~1//LOCALS~1/Temp/customProfileDir8708f7f69e14482ba857f4b2e74775c1/core/RemoteRunner.hta So this break script execution, could you assist? I saw a related topics at msdn and openqa but didn't find resolution that could help me.

Thanks, Sergiy

A: 

I've just updated a section about that in the Selenium docs. The website build is not working right now, so if you go to the site you will find the old version.

I'll paste the raw text here, I think your case is the second: JS trying to access sections that are still not loaded, so your solution would be a waitForPopUp command:

Why am I getting a permission denied error?

The most common reason for this error is that your session is attempting to violate the same-origin policy by crossing domain boundaries (e.g., accesses a page from http://domain1 and then accesses a page from http://domain2) or switching protocols (moving from http://domainX to https://domainX). For this to be solved, try using the Heightened Privileges Browsers if you're working with the Proxy Injection browsers. This is covered in some detail in the tutorial. Make sure you read the sections about The Same Origin Policy and Proxy Injection carefully.

If the previous situation was not your case, it can also occur when JavaScript attempts to look at objects which are not yet available (before the page has completely loaded), or tries to look at objects which are no longer available (after the page has started to be unloaded). This is most typically encountered with AJAX pages which are working with sections of a page or subframes that load and/or reload independently of the larger page. For this type of problem, it is common that the error is intermittent. Often it is impossible to reproduce the problem with a debugger because the trouble stems from race conditions which are not reproducible when the debugger's overhead is added to the system. Try first adding a static pause to make sure this is the situation and then moving on to the waitFor kind of commands.

Santi
Santi, thx for fast answer but these solutions didn't help. I'have added delays but permission denied still appear. After I manually press the yes/no at error I'm getting popup but script execution breaks. In main window I'm also have content the same as in popup. If I do this scenario manually content in main window doesn't changes after opening the popup.
A: 

I have exactly the same problem and I do not get rid of it. The error happens, while clicking on the button

selenium = myDevice.getSelenium();
selenium.selectWindow("");
Thread.sleep(2000);
selenium.click("btnMyButton");

This is the html code of the button:

<input name="btnMyButton" id="btnMyButton" type="button" onclick="javascript:MyFunction();" tabindex="0" disabled="disabled" value="btnMyButton" title="btnMyButton" />

Remark: The button is disabled by default, but enabled by java script. And yes I ensured that it is enabled during my test.

The js function looks like this:

function MyFunction()
{
    if (document.all.txtLogin.value.length > 0)
    {
        document.all.txtPassword.value = "";
        var result = showModalDialog("MyPage.aspx),null,"scroll:no;status:no;unadorned:no;help:no;edge:raised;center:yes;resizable:no;dialogHeight:160px;dialogWidth:360px");
    }
}
lasombra
A: 

I've just encountered this error. In the end it was because I was running IE in 'Offline' mode. Open the File menu and make sure that "Work Offline" does not have a tick next to it.

torrlane