Selenium Proxy Problem

View: New views
1 Messages — Rating Filter:   Alert me  

Selenium Proxy Problem

by PU :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am trying a run a basic test case using selenium RC but no success

It seems that there is a proxy problem bcoz our company has its internal proxy and selenium could not able to bypass that proxy.

The moment it run Google.java using java Google. It opens two mozilla browser. In 1 browser -Selenium Remote Control v1.0 [2677], with core v@VERSION@ [@REVISION] - Mozilla Firefox it search for

chrome://src/content/RemoteRunner.html?sessionId=07089224a43b4a5e8e8ec0cb91a6719f&multiWindow=true&baseUrl=http%3A%2F%2Fwww.google.com%2F&debugMode=false&driverUrl=http://localhost:4444/selenium-server/driver/

and in other it search for

http://localhost:4444/selenium-server/core/Blank.html?start=true

Please HELP as I am very NEW to selenium and not able to resolve this since long

Please find the server logs in-line:

[purvi@localhost selenium-server-1.0]$ java -jar selenium-server.jar  -Dhttp.proxyHost=proxy.company.com -Dhttp.proxyPort=8080 -Dhttp.proxyUser=12345 -Dhttp.proxyPassword=xyz@2009 -Dhttp.nonProxyHosts="*.localdomain.com|localhost"
Setting system property http.proxyHost to proxy.company.com
Setting system property http.proxyPort to 8080
Setting system property http.proxyUser to 12345
Setting system property http.proxyPassword to xyz@2009
Setting system property http.nonProxyHosts to *.localdomain.com|localhost
18:12:03.997 INFO - Java: Sun Microsystems Inc. 1.6.0_0-b12
18:12:03.998 INFO - OS: Linux 2.6.27.5-117.fc10.i686 i386
18:12:04.005 INFO - v1.0 [2677], with Core v@VERSION@ [@REVISION@]
18:12:04.101 INFO - Version Jetty/5.1.x
18:12:04.102 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
18:12:04.103 INFO - Started HttpContext[/selenium-server,/selenium-server]
18:12:04.103 INFO - Started HttpContext[/,/]
18:12:04.115 INFO - Started SocketListener on 0.0.0.0:4444
18:12:04.115 INFO - Started org.mortbay.jetty.Server@ae506e
18:12:14.959 INFO - Checking Resource aliases
18:12:14.964 INFO - Command request: getNewBrowserSession[*chrome, http://www.google.com/, ] on session null
18:12:14.966 INFO - creating new remote session
18:12:15.141 INFO - Allocated session 2b38a8108a4648388dc058273f7bf221 for http://www.google.com/, launching...
18:12:15.198 INFO - Preparing Firefox profile...
18:12:18.425 INFO - Launching Firefox...
18:12:20.886 INFO - Got result: OK,2b38a8108a4648388dc058273f7bf221 on session 2b38a8108a4648388dc058273f7bf221
18:12:20.892 INFO - Command request: open[http://12345:xyz@2009@proxy.company.com:8080/, ] on session 2b38a8108a4648388dc058273f7bf221
18:12:20.892 WARN - you appear to be changing domains from http://www.google.com/ to http://12345:xyz@2009@proxy.company.com:8080/
this may lead to a 'Permission denied' from the browser (unless it is running as *iehta or *chrome,
or alternatively the selenium server is running in proxy injection mode)
18:12:26.110 INFO - Got result: OK on session 2b38a8108a4648388dc058273f7bf221
18:12:26.112 INFO - Command request: type[q, selenium] on session 2b38a8108a4648388dc058273f7bf221
18:12:26.128 INFO - Got result: ERROR: Element q not found on session 2b38a8108a4648388dc058273f7bf221
18:12:26.131 INFO - Command request: testComplete[, ] on session 2b38a8108a4648388dc058273f7bf221
18:12:26.131 INFO - Killing Firefox...
18:12:26.176 INFO - Got result: OK on session 2b38a8108a4648388dc058273f7bf221

More logs:

[purvi@localhost Selenium]$ javac com/example/tests/Google.java
[purvi@localhost Selenium]$ java com/example/tests/Google
.E
Time: 11.319
There was 1 error:
1) testNew(com.example.tests.Google)com.thoughtworks.selenium.SeleniumException: ERROR: Element q not found
    at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
    at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
    at com.thoughtworks.selenium.DefaultSelenium.type(DefaultSelenium.java:291)
    at com.example.tests.Google.testNew(Google.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
    at com.example.tests.Google.main(Google.java:32)

FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1

Google.java

package com.example.tests;

import junit.framework.*;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
//import org.testng.Reporter;

public class Google extends SeleneseTestCase {

    public void setUp() throws Exception {
        setUp("http://www.google.com/", "*chrome");
    }
    public void testNew() throws Exception {
        selenium.open("http://12345:xyz@2009@proxy.company.com:8080/");
                //if(selenium.isElementPresent("q")) {
                    selenium.type("q", "selenium");
                //} else {
        //        Reporter.log("Element: is not available on page.");
    //    }
        selenium.click("btnG");
        selenium.waitForPageToLoad("60000");
        selenium.click("link=Selenium web application testing system");
        selenium.waitForPageToLoad("60000");
        selenium.click("//a[contains(text(),'The Magic of Selenium: How it\n    works')]");
        selenium.waitForPageToLoad("60000");
        assertTrue(selenium.isTextPresent("Selenium IDE"));
    }
        public static Test suite() {
        return new TestSuite(Google.class);
    }
    public static void main(String args[]) {
        junit.textui.TestRunner.run(suite());
    }

}