Maven selenium selenese error: Unexpected Exception: Permission denied to get property Location.href

From Foochal

Jump to: navigation, search

Contents

Error when trying to run maven selenium:selenese

I get the following error when running maven selenium:selenese

error: Caught an exception attempting to log location; this should get noticed soon!
error: Unexpected Exception: Permission denied to get property Location.href

Reason

This is due to the Mozilla Same origin policy which prevents document or script loaded from one origin from getting or setting properties of a document from a different origin.

Solution

Change your pom configuration to use the startURL from the same origin as the URLs in your tests.

The following config will fail

if the config is:

<plugin>
 <groupId>org.codehaus.mojo</groupId>
 <artifactId>selenium-maven-plugin</artifactId>
 <configuration>
  <browser>*firefox</browser>
  <suite>src/test/selenium/suite.html</suite>
  <startURL>http://startURL1.some.extension/</startURL>
 </configuration>
</plugin>

but the tests refer to: http://startURL2.some.extension/

The following config passes

<plugin>
 <groupId>org.codehaus.mojo</groupId>
 <artifactId>selenium-maven-plugin</artifactId>
 <configuration>
  <browser>*firefox</browser>
  <suite>src/test/selenium/suite.html</suite>
  <startURL>http://startURL3.some.extension/</startURL>
 </configuration>
</plugin>

and the tests refer the same startURL: http://startURL3.some.extension/


Personal tools