Copied from [1]:

The quick answer is that because of cross-site scripting security built into JavaScript engines in all browsers, you can't edit the content of a web page from another domain. The foreign page will probably load correctly and be visible in the test runner window, but Selenium won't be able to query or edit its contents.

In other words, you can't run selenium on "foo.com" and run a test that edits values and clicks buttons against "bar.com". So, in its current form, you can't "script" google.com because your script isn't currently hosted on google.com. When Selenium and the application you are testing is hosted on the same domain, however, you do not run into the cross-site scripting security feature/limitation.

You can read more about cross-site scripting here: Dev Articles [2]

Hth,

Nick Stolwijk

[1] http://wiki.openqa.org/display/SEL/Selenium+Core+FAQ
[2] http://www.devarticles.com/c/a/JavaScript/JavaScript-Security/

<http://www.devarticles.com/c/a/JavaScript/JavaScript-Security/>



Marco Mistroni wrote:
hi all,
 i am trying out Maven2 with selenium plugin, but i am getting alwasy
same error and i was wondering if anyone else here came across
same situation...

here's my test
************************  ( i had my own url but as i kept on getting
exceptions i tried with a well known one ************
public class LoginTest extends SeleneseTestCase {
        public void testLogin() throws Exception {
                selenium.open("http://www.google.com";);
                verifyTrue(selenium.isTextPresent("Google"));//Hello and 
Welcome to
BudgetWeb V2 Application"));
        }
}


*************** here's my pom (only relevant part) *******************
<plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.0.1</version>
       </plugin>
       <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>selenium-maven-plugin</artifactId>
                        <executions>
                                <execution>
                                        <id>start</id>
                                        <phase>pre-integration-test</phase>
                                        <goals>
                                        <goal>start-server</goal>
                                        </goals>
                                        <configuration>
                                        <background>true</background>
                                        <logOutput>true</logOutput>
                                        <multiWindow>true</multiWindow>
                                        </configuration>
                                </execution>
                                <execution>
                                        <id>stop</id>
                                        <phase>post-integration-test</phase>
                                        <goals>
                                        <goal>stop-server</goal>
                                        </goals>
                                </execution>
                        </executions>
           </plugin>
           <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                        <version>0.3-SNAPSHOT</version>
                        <configuration>
                                <wait>false</wait>
                                <container>
                                        <containerId>jetty6x</containerId>
                                        <type>embedded</type>
                                </container>
                        </configuration>
                        <executions>
                                <execution>
                                        <id>start-container</id>
                                        <phase>pre-integration-test</phase>
                                        <goals>
                                        <goal>start</goal>
                                        <goal>deploy</goal>
                                        </goals>
                        </execution>

                        <execution>
                                <id>stop-container</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                        <goal>stop</goal>
                                </goals>
                        </execution>
                </executions>
           </plugin>
       <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                                <excludes>
                                         
<exclude>**/uattests/*Test.java</exclude>
                                </excludes>
                                <systemProperties>
                                        <property>
                                                
<name>net.sourceforge.cobertura.datafile</name>
                                                
<value>target/cobertura/cobertura.ser</value>
                                        </property>
                                </systemProperties>
                        </configuration>
                        <executions>
                                <execution>
                                        <id>integration-tests</id>
                                        <phase>integration-test</phase>
                                                <goals>
                                                        <goal>test</goal>
                                                </goals>
                                                <configuration>
                                                        <skip>false</skip>
                                                                <excludes>
                                                                
<exclude>none</exclude>
                                                                </excludes>
                                                                <includes>
                                                                
<include>**/uattests/*Test.java</include>
                                                                </includes>
                                                </configuration>
                                  </execution>
                        </executions>
           </plugin>


************ and here' smy exception *************
testLogin(com.example.uattests.LoginTest)  Time elapsed: 15.385 sec  <<< ERROR!
com.thoughtworks.selenium.SeleniumException: Permission denied to get
property Location.href
        at 
com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:73)
        at 
com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:222)
        at com.example.uattests.LoginTest.testLogin(LoginTest.java:13)
        at com.example.uattests.LoginTest.testLogin(LoginTest.java:13)
        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:585)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at 
com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:71)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingM




FYI i copied sample from here

http://wiki.foochal.org/index.php/Maven_Selenium

anyone could help me out?

thanks in advance and regards
 marco

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to