Skip to content
This repository has been archived by the owner. It is now read-only.

UnhandledWebDriverError: Permission denied for <http://www.facebook.com> to get property Window.frameElement - SEE COMMENTS 47, 55 AND 64 FOR WORKAROUND #2863

Closed
lukeis opened this issue Mar 3, 2016 · 64 comments

Comments

@lukeis
Copy link
Member

@lukeis lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 2863

I'm sending a message to select an iframe (http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/frame)
to selenium via the facebook php bindings / RemoteWebDriver, but instead of selecting
the frame I'm getting an exception:

08:38:00.730 WARN - Exception thrown
org.openqa.selenium.WebDriverException: Permission denied for <http://www.facebook.com>
to get property Window.frameElement; duration or timeout: 15.04 seconds
Build info: version: '2.12.0', revision: '14666', time: '2011-11-10 18:35:23'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version:
'1.6.0_29'
Driver info: driver.version: RemoteWebDriver

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

    at java.lang.reflect.Constructor.newInstance(Unknown Source)

    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:147)

    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:113)

    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:416)

    at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.frame(RemoteWebDriver.java:636)

    at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringTargetLocator.frame(EventFiringWebDriver.java:561)

    at org.openqa.selenium.remote.server.handler.SwitchToFrame.call(SwitchToFrame.java:52)

    at org.openqa.selenium.remote.server.handler.SwitchToFrame.call(SwitchToFrame.java:1)

    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)

    at java.util.concurrent.FutureTask.run(Unknown Source)

    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

    at java.lang.Thread.run(Unknown Source)

Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Permission
denied for <http://www.facebook.com> to get property Window.frameElement
Build info: version: '2.12.0', revision: '14666', time: '2011-11-10 18:35:23'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version:
'1.6.0_29'
Driver info: driver.version: unknown

I'm using Firefox 8.  I can't tell whether this is new behavior since changing from
FF8 or Selenium 2.11 or changing to the facebook php bindings.  Sorry I can't be more
specific but a lot is in flux at the moment.  It does happen 100% of the time though.

Here's the relevant line from the selenium log:

08:37:45.693 INFO - Executing: [switch to frame: app_runner_4ec53860c57652b93621183]
at URL: /session/1321547817083/frame)

Thanks for your help.

-DB

Reported by dbyron0 on 2011-11-17 16:46:41

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I did a bit of version swapping and figured this out.  I no longer get the exception
with Firefox 7, using selenium 2.12.  So perhaps FF8 is doing something differently?
With any luck the stack trace is helpful.

Reported by dbyron0 on 2011-11-17 17:40:21

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

This should be fixed by r14704 (i.e. will be part of the 2.13 release). Please reopen
if that's not the case.

Reported by jari.bakken on 2011-11-17 18:36:39

  • Status changed: Fixed

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Selenium 2.13 works with FF7, but when I upgrade to FF8 I get the same stack trace as
with 2.12.

Reported by dbyron0 on 2011-11-18 16:25:30

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Reported by jari.bakken on 2011-11-18 23:30:12

  • Status changed: New

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I can confirm this happens for Firefox 8 when switching to a frame with an empty ID
provided:

driver.switchTo().frame("");

Once I added the proper ID instead of an empty string the exception was gone.

Reported by VooooD on 2011-11-19 12:00:49

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Reported by barancev on 2011-11-19 15:42:42

  • Labels added: Component-WebDriver, Browser-Firefox

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

As far as I can tell, the JSON I'm sending includes a non-empty ID.  I don't think curl
in php doesn't have something like CURLOPT_DEBUGFUNCTION and I haven't looked a protocol
analyzer, but I believe I'm sending:

{"id":"app_runner_4eca6feeba17f4c43088079"}

Reported by dbyron0 on 2011-11-21 15:36:48

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

@VooooD  Try finding a WebElement for the frame and switching to that:

WebElement iframe = driver.findElement(By.name("my-iframe"));
driver.switchTo().frame(iframe);

@dbyron0 You could try the same, but I'm not sure if the php bindings support this.

Reported by jmleyba on 2011-11-25 03:31:27

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Reported by barancev on 2011-11-25 08:21:38

  • Status changed: NeedsClarification

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

@jmleyba

FirefoxDriver driver;
driver.get("some_page");
FirefoxDriver newDriver = (FirefoxDriver) driver.switchTo().frame("iframe_canvas");

The above code did the trick for me. Why are you trying to reference the iframe as
a WebElement?

Reported by VooooD on 2011-11-25 08:39:43

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I can't tell if the NeedsClarification status is for me or not.  I just tried this with
selenium 2.14.  I get the same exception.  The stack trace is slightly different so
here it is:

11:20:23.711 WARN - Exception thrown
org.openqa.selenium.WebDriverException: Permission denied for <http://www.facebook.com>
to get property Window.frameElement; duration or timeout: 15.11 seconds
Build info: version: '2.14.0', revision: '14955', time: '2011-11-29 11:42:43'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version:
'1.6.0_29'
Driver info: driver.version: RemoteWebDriver

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

    at java.lang.reflect.Constructor.newInstance(Unknown Source)

    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:147)

    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:113)

    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:400)

    at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.frame(RemoteWebDriver.java:620)

    at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringTargetLocator.frame(EventFiringWebDriver.java:561)

    at org.openqa.selenium.remote.server.handler.SwitchToFrame.call(SwitchToFrame.java:52)

    at org.openqa.selenium.remote.server.handler.SwitchToFrame.call(SwitchToFrame.java:1)

    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)

    at java.util.concurrent.FutureTask.run(Unknown Source)

    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

    at java.lang.Thread.run(Unknown Source)


Reported by dbyron0 on 2011-12-01 19:23:49

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Issue 3018 has been merged into this issue.

Reported by barancev on 2011-12-08 07:09:23

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Issue 2929 has been merged into this issue.

Reported by dawagner on 2011-12-08 15:25:30

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Recently merged Issue 3018 came from Issue 2921.

I was not getting the Permission Denied Facebook error using Se v2.13 & FF v8.

The fix (r15093) from Issue 2921 (which I tested independently before it was released
with 2.14) is what started consistently generating this error for me. (If this helps)

Reported by titus.fortner@tippr.com on 2011-12-08 16:26:13

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Why is this ticket in the NeedsClarification state? I am seeing this consistently as
well and if you let us know what other information you need, we can provide it. This
has become a big issue for us because we had to update firefox to the latest version
and now most of our tests do not work.

Reported by mariofduarte on 2011-12-12 09:59:29

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Is there a workaround to this problem for who has to use FF8?

Reported by slider3 on 2011-12-12 22:06:26

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Setting capability.policy.default.Window.frameElement to "allAccess" in FF profile might
help. It does not answer the question WHY it started to be like that.

Reported by nebehr.gudahtt on 2011-12-13 13:18:40

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

we have several tests within facebook which started failing with this change as well.
used to work in older 2.x builds as other have mentioned.

Reported by jubishop on 2011-12-13 21:02:11

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Seeing this consistently on ff8 Windows with Selenium 2.15

Reported by pettazz on 2011-12-13 23:46:00

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I've the same problem, however, the event is different in my case.

WebElement element = WaitForObjectToLoadAndReturnIfExist (strXpath,intSyncTimeOut);
...
...
element.click();

I guess the problem is same.

With Selenium 2.15 and FF 8.0.1

Reported by nilanjan.gm on 2011-12-15 11:30:29

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I get something very similar, but not for facebook.

'Error: Permission denied for <http://localhost:3001> to get property HTMLDocument.compatMode'
when calling method: [wdIMouse::move] (Selenium::WebDriver::Error::UnknownError)

The page is very JS heavy, and uses iframes to handle async uploads.  Basically any
attempt to click anything on the page fails with this error.  Let me know if I can
try anything, this is quite an important part of our site to have automated tests for.

Reported by patrick@redbubble.com on 2011-12-22 03:31:07

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

@VooooD - the code that jmleyba provided was the only code that worked for me via the
C# WebDriver (2.15) w/ Firefox 8.0. I think it may have something to do with the order
by which certain operations are completed in the different methods (and perhaps this
isn't an issue for all drivers or works differently for other drivers) such that the
underlying code that finds the iframe, when the iframe is provided by name, is not
equivalent to driver.findElement(By.name("my-iframe"));

Reported by s4Logic on 2011-12-23 23:36:29

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Seeing the same problem with FF9 and FF8 (works fine with FF7)
WebDriver: 2.17.0

This error occurred on clicking <a> link.

======================================================================================================================================
org.openqa.selenium.WebDriverException: Permission denied for <http://reviews.crateandbarrel.com>
to get property HTMLDocument.compatMode
Command duration or timeout: 29 milliseconds
Build info: version: '2.17.0', revision: '15540', time: '2012-01-16 16:52:31'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version:
'1.6.0_27'
Driver info: driver.version: RemoteWebDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.6.0_27]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
~[na:1.6.0_27]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
~[na:1.6.0_27]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513) ~[na:1.6.0_27]
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:147)
~[selenium-java-2.17.0.jar:na]
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:113)
~[selenium-java-2.17.0.jar:na]
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:439) ~[selenium-java-2.17.0.jar:na]
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:231)
~[selenium-java-2.17.0.jar:na]
    at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:72) ~[selenium-java-2.17.0.jar:na]
======================================================================================================================================


Reported by mgoodnow80 on 2012-01-17 17:44:08

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

@mgoodno...@gmail.com: You're very welcome. This has also been a huge issue for me and
my organization. Please see below for a small addition to my example which may help
you further.

@dawagner@gmail.com: I'll see if I can create a reproducible test which demonstrates
this error. First attempts at a basic Selenium IDE test have strangely proven unsuccessful.
I'll keep at it.


Since I made the post the other day, I've discovered that the command that triggers
the JavaScript error actually doesn't get executed. That being true, we need to retry
the command. In order to ensure that the command you sent was actually executed, you
have to call the do_command method from itself. Below is the modified, unofficial patch:

(Example in Python using Selenium client library 2.20.0)
Before:
216  if (not data.startswith('OK')):
217      raise Exception, data
218  return data

After:
216  if (data.startswith('Permission denied for')):
217      print "[JavaScript Error] Message: '%s' Retrying command." % data
218      self.do_command(verb, args)
219  elif (not data.startswith('OK')):
220      raise Exception, data
221  return data


@praneeth...@gmail.com: This patch applies to the library you interface with to run
methods like sel.click, sel.wait_for_page_to_load, sel.type, etc. If you want to apply
this same change, you need to locate the do_command method within that library which
should be near the top, just below the documentation.

Explanation of this patch:
When you get a response from your remote Selenium Server, your local client library
reads the beginning of the response. If it starts with the text "OK", it indicates
that the command you sent to the selenium server was successful and continues on with
your test. If it encounters anything else, it raises an exception passing the data
of the error so that a language appropriate exception can be thrown. What I've done
is right before it checks for "OK" is inserted an interception of the check. My patch
checks if the response from the Selenium Server starts with the text "Permission denied
for". If this is encountered, it prints "[JavaScript Error] Message: '<message text>'
Retrying command." then retries the command until successful.

I've added some debug statements in the library to show the format of the request and
returning data. In this example, I am logging into my client's website. You will also
see upon arriving at the member area after log in, it tries to run 'waitForPageToLoad',
it receives the permission error and retries the command. Once it receives 'OK' from
that request, it continues on to verify a <div> with my username is present on the
page.

Here is the output:

Request:  open, [u'http://www.example.com:80', 'true']
Response: u'OK'
Request:  waitForPageToLoad, [60000]
Response: u'OK'
Request:  windowMaximize, []
Response: u'OK'
Request:  getEval, ['window.moveTo(1,0)']
Response: u'OK,null'
Request:  click, ["//div[@id='banner']//a[text()='Sign In']"]
Response: u'OK'
Request:  waitForPageToLoad, [60000]
Response: u'OK'
Request:  type, ["//input[@name='login']", 'tharrison@******.com']
Response: u'OK'
Request:  type, ["//input[@name='password']", '********']
Response: u'OK'
Request:  click, ["//input[@value='Sign In']"]
Response: u'OK'
Request:  waitForPageToLoad, [60000]
Response: u'Permission denied for <https://www.facebook.com> to get property Location.href'
[JavaScript Error] Message: 'Permission denied for <https://www.facebook.com> to get
property Location.href' Retrying command.
Request:  waitForPageToLoad, [60000]
Response: u'OK'
Request:  isElementPresent, ["//div[@class='username' and text()='tharrison']"]
Response: u'OK,true'

Reported by timlamirada on 2012-04-16 19:22:10

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

 timlamir...@gmail.com 
 In my case its happening when i open the twitter url, ihave extracted the selenium-standalone-2.20.jar
file, there are all class files iam unable to locate the source file, can you please
tell me name of the source file to modify and where can i find the source file to modified
as patch and as my test uses DefaultSelenium class(selenium1).

Reported by praneeth.krishna on 2012-04-17 06:34:08

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I'm facing same problem with 2.20.0 with FF 8.0.1

While trying to switch the control to iframe this problem occurring.

org.openqa.selenium.WebDriverException: Permission denied for <http://www.xxxxxxxxxxxxx.com>
to get property Window.frameElement
Command duration or timeout: 50.09 seconds
Build info: version: '2.20.0', revision: '16008', time: '2012-02-27 19:03:04'
System info: os.name: 'Windows Vista', os.arch: 'amd64', os.version: '6.1', java.version:
'1.6.0_10'
Driver info: driver.version: RemoteWebDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:170)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:123)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:438)
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.frame(RemoteWebDriver.java:669)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Permission
denied for <http://www.xxxxxxxxxxxxxxxxx.com> to get property Window.frameElement
Build info: version: '2.20.0', revision: '16008', time: '2012-02-27 19:03:04'
System info: os.name: 'Windows Vista', os.arch: 'amd64', os.version: '6.1', java.version:
'1.6.0_10'
Driver info: driver.version: unknown

Reported by santoshsarma.jv on 2012-04-18 07:29:37

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

We get that this is a problem.  We don't need more comments saying "I have this problem"
- unless you have a test case to add, please don't bother commenting!

Note: This seems to have happened in Firefox 8; if you use Firefox 7, you probably
won't see the problem.

Reported by dawagner on 2012-04-18 08:34:07

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Here is a simple reproducible testcase in Python: https://gist.github.com/2413653

Reported by dave.hunt on 2012-04-18 13:46:16

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

This is a problem introduced by Firefox 8's cross-origin frame lock-down.  Unfortunately,
without some changes to Firefox, it's unlikely we will be able to fix this bug.

In the mean time, you can work around it by setting the following settings in a FirefoxProfile:

capability.policy.default.Window.QueryInterface='allAccess'
capability.policy.default.Window.frameElement.get='allAccess'

Note that doing so will disable all cross-origin checks in the browser, so your tests
will no longer be able to verify that there are no cross-origin javascript requests,
which are blocked by the browser.  Accordingly, we will not be making this behaviour
the default for selenium.

Reported by dawagner on 2012-05-02 13:54:08

  • Status changed: Accepted

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

As a note:  even after the two capability updates you might still recieve errors about
permission denied.  If so given an error of "Permission denied for URL to get property
X.Y follow the following syntax

capability.policy.default.X.Y.get='allAccess'

to enable that capability and work around each permission as you get them.  Sort of
a game of whack-a-mole, but you will find the answer.

Reported by llaskin on 2012-05-02 14:26:32

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Issue 3217 has been merged into this issue.

Reported by barancev on 2012-05-05 14:28:57

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Great guys . 

I used to get "Permission denied " error while switching to iframe . I am using selenum
2.12 and FF 12. 

Now I just followed the workaround here. 

FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("capability.policy.default.Window.QueryInterface",
"allAccess");        profile.setPreference("capability.policy.default.Window.frameElement.get",
"allAccess");

It is working great ..!! 

thanks thanks thanks :)

Reported by vamshikurra on 2012-05-15 06:52:27

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Issue 4048 has been merged into this issue.

Reported by luke.semerau on 2012-06-07 22:36:24

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I am having the same issue but with HTMLDocument.compatMode

I have added the follwing code to my firefox constructer: 

FirefoxProfile profilex = new FirefoxProfile();
                profilex.setPreference("capability.policy.default.Window.QueryInterface",
"allAccess");
                profilex.setPreference("capability.policy.default.Window.frameElement.get",
"allAccess");
                profilex.setPreference("capability.policy.default.Window.HTMLDocument.compatMode.get",
"allAccess");

                capabilities.setCapability(FirefoxDriver.PROFILE, profilex ) ;


However, this does not act as a work around and we still hit the issue, making our
test site untestable in firefox. 


Reported by foley85 on 2012-06-15 09:14:47

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I believe you want:
profilex.setPreference("capability.policy.default.HTMLDocument.compatMode.get", "allAccess");
or possibly
profilex.setPreference("capability.policy.default.Document.compatMode.get", "allAccess");

Reported by dawagner on 2012-06-15 13:43:46

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

This happens even in Selenium 2.24.1 and Firefox 12.

The property I had to "allAccess" in my case was "Window.mozInnerScreenY".

I don't need an ETA, but do the devs have a "clue" of what's going on at least?
From the sound of it, if feels like it's Firefox security that is suddenly become "anal",
in a way that breaks WebDriver. Am I right?

Reported by detronizator on 2012-06-20 19:10:34

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Just to share some light, that's what we are currently using in our temporary profiles
to "avoid" those issues:

        // Loosening Cross-Domain security Checks in Firefox
        // Selenium Issue: http://code.google.com/p/selenium/issues/detail?id=2863
        setPreference("capability.policy.default.HTMLDocument.readyState","allAccess");
        setPreference("capability.policy.default.HTMLDocument.compatMode","allAccess");
        setPreference("capability.policy.default.Document.compatMode","allAccess");
        setPreference("capability.policy.default.Location.href","allAccess");
        setPreference("capability.policy.default.Window.pageXOffset","allAccess");
        setPreference("capability.policy.default.Window.pageYOffset","allAccess");
        setPreference("capability.policy.default.Window.frameElement","allAccess");
        setPreference("capability.policy.default.Window.frameElement.get","allAccess");
        setPreference("capability.policy.default.Window.QueryInterface","allAccess");
        setPreference("capability.policy.default.Window.mozInnerScreenY","allAccess");
        setPreference("capability.policy.default.Window.mozInnerScreenX","allAccess");

Why so many? We don't control which test we run: our service leaves the customer free
to write it's own selenium/webdriver tests. Hence, we are hitting all sort of Permission
issues, not just the "few" we saw before.

I thought it was "good neighbourhood-hood" too share :)

Reported by detronizator on 2012-06-20 20:31:27

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

I'm also seeing this in Firefox Selenium IDE 1.8.1
[error] isNewPageLoaded found an old pageLoadError: Error: Permission denied for <http://www.facebook.com>
to get property Location.href
[error] Permission denied for <http://www.facebook.com> to get property Location.href

This occurs when running the open page action where the page has the following declared
in the html element.

<!DOCTYPE HTML>
<html gecko="helper"  xmlns:og="http://opengraphprotocol.org/schema/"
      xmlns:fb="http://www.facebook.com/2008/fbml" >

Reported by bugtank on 2012-06-27 12:08:22

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

@mihai.poplacenel

Mihai, thank you for reporting this issue but commenting the way you have is not constructive.
Since Selenium is a volunteer project we do what we can when the core team have time.
If you can help narrow down the regression, which needs to be done on Firefox and Selenium,
that would be really helpful and someone with your experience should find the task
rather trivial.

Reported by david.burns@theautomatedtester.co.uk on 2012-06-28 17:27:59

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

@mihai: glad to help. Trust me: the firefox driver people are well aware of
what's happening. ButI guess the workaround is easy enough that they prefer
to focus on shipping the next firefox driver that shouldn't have those
issues.

Reported by detronizator on 2012-06-28 20:57:43

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Sorry for the non-constructive comment - I deleted it and I'm trying to start over in
a  constructive way. I meant to suggest that someone from the Selenium WebDriver team
summarizes what the workarounds are for the various environments and updates the forums.
It is difficult for someone to get around this, and it seems like a long-standing issue
and still present in latest-n-greatest (Firefox 13 with Selenium 2.24.1). I will try
to help you with a reproducible if I manage to get it out to the public domain.

Thanks to all the folks who helped with this issue, and to the Selenium WebDriver team
who put together a great and very useful product. 

Reported by mihai.poplacenel on 2012-06-28 20:58:59

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

mihai,

This bug is inside Firefox, and we suspect due to a security model change inside Firefox.
 We have escalated to Engineers at Mozilla, who are working on tracking down exactly
what happened, and fixing it.

In comment 47, I gave a workaround for this problem, as well as the drawbacks you'll
suffer from doing so, and an explanation as to why we are not implementing the workaround
inside selenium.

In the comments following, others have expanded on the workaround, and I have tried
to help people with specific problems.

In comment 55, detronizator gave a fairly thorough workaround.

Unfortunately, there is no way for me to draw particular attention to these workarounds,
e.g. I can't edit the original bug report message.

I have changed the title of this bug report to point people at the workarounds.

I am going to close this bug to comments; we understand where the problem here lies,
it's not inside selenium, we're blocked on changes or debugging inside firefox by mozilla
to get it fixed, and a workaround has been published.  We do not need any reproduction
cases (I never thought I'd say that on a selenium bug!) If anyone has any particular
insights in to the problem which may help, please email selenium-developers@googlegroups.com,
but if you can't point at the firefox revision which caused the problem, you probably
don't have the right insight.

To reiterate, if you are seeing this problem, you can work around it by:
1) Looking at the exception you get, which should contain text like "Permission denied
... to get property Window.frameElement
2) Adding to your FirefoxProfile the preference:
capability.policy.default.Window.frameElement.get='allAccess', or something like it
depending on exactly what property/method/thing access is being denied to.
3) Iterating, adding more preferences as you encounter more problems.
Comment 55 has a fairly thorough set of preferences to set.

Note that by doing so, your tests will no longer detect bugs where the browser prevents
cross-origin frame access from javascript.

Reported by dawagner on 2012-06-28 22:27:57

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Reported by dawagner on 2012-06-28 22:29:14

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Regression range has been found in http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=a627b24e684e&tochange=cef1817c3b13
and have emailed the relevant people

Reported by david.burns@theautomatedtester.co.uk on 2012-06-29 15:18:13

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

This is now working in the release branch of Firefox. The cause was never found but
obviously was a regression for something else. Closing this bug now.

Reported by david.burns@theautomatedtester.co.uk on 2012-08-29 09:49:23

  • Status changed: Fixed

@lukeis
Copy link
Member Author

@lukeis lukeis commented Mar 3, 2016

Issue 4487 has been merged into this issue.

Reported by barancev on 2012-09-27 19:20:38

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant