Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion problem using proxy with selenium but not standalone
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Patrick Lightbody  
View profile  
 More options Apr 18 2012, 7:28 am
From: Patrick Lightbody <patr...@lightbody.net>
Date: Wed, 18 Apr 2012 07:28:36 -0400
Local: Wed, Apr 18 2012 7:28 am
Subject: Re: problem using proxy with selenium but not standalone

Sorry, been swamped. I have about 20 emails to reply to for BMP - hoping to get to it tonight!

--
Patrick Lightbody
+1 (415) 830-5488

On Apr 18, 2012, at 4:54 AM, Graham wrote:

> Hi Patrick,

> Did you have a chance to investigate this?

> thanks,
> Graham

> On Tuesday, 27 March 2012 10:34:32 UTC+1, Graham wrote:
> Hi Patrick,

> I see the same issue with our production site.

> The demo test is:

> import com.paddypower.reporter.ReporterInterface;
> import com.paddypower.reporter.SeleniumReporterFactory;
> import org.browsermob.core.har.Har;
> import org.browsermob.proxy.ProxyServer;
> import org.openqa.selenium.remote.CapabilityType;
> import org.openqa.selenium.remote.DesiredCapabilities;
> import org.openqa.selenium.remote.RemoteWebDriver;
> import org.openqa.selenium.server.RemoteControlConfiguration;
> import org.openqa.selenium.server.SeleniumServer;
> import org.testng.annotations.Test;

> import java.io.File;
> import java.io.IOException;
> import java.net.URL;
> import java.util.ArrayList;
> import java.util.HashMap;
> import java.util.Map;

> /**
>  * User: gabell
>  * Date: 27/03/12
>  * Time: 10:18
>  */
> public class demo {

>     @Test(priority = 1, groups = {"demo"},
>             description = "demo test")
>     public void test1() throws IOException {

>         //System.setProperty("webdriver.chrome.driver", "library\\Chromedriver\\chromedriver.exe");
>         DesiredCapabilities capabilities = DesiredCapabilities.chrome();
>         ArrayList<String> switches = new ArrayList<>();
>         switches.add("--start-maximized");
>         switches.add("--disable-application-cache");
>         switches.add("--disk-cache-size=1");
>         switches.add("--media-cache-size=1");
>         switches.add("--disk-cache-dir=c:\\cache");
>         switches.add("enable-file-cookies");
>         switches.add("--disable-popup-blocking");
>         capabilities.setCapability("chrome.switches", switches);

>         ProxyServer proxyServer = new ProxyServer(4443);
>         try {
>             proxyServer.start();
>             Map options = new HashMap<String, String>();
>             options.put("httpProxy", "ppwebaccess1:8080");
>             proxyServer.setOptions(options);
>         } catch (Exception e) {
>             e.printStackTrace();
>         }

>         capabilities.setCapability(CapabilityType.PROXY, proxyServer.seleniumProxy());

>         RemoteWebDriver driver = new RemoteWebDriver(new URL(startStandaloneServer()), capabilities);

>         proxyServer.newHar("homepage");
>         driver.get("http://www.paddypower.com/bet");

>         Har har = proxyServer.getHar();
>         har.writeTo(new File("c:\\test1.har"));
>         ReporterInterface reporter = SeleniumReporterFactory.getSeleniumReporter();
>         reporter.log("");

>     }

>     private static String startStandaloneServer() {
>         //String hubURL = "http://localhost:8080/wd/hub";  //Android
>         String hubURL = "http://127.0.0.1:4444/wd/hub";

>         //Start the server
>         RemoteControlConfiguration rc = new RemoteControlConfiguration();
>         rc.setPort(4444);
>         rc.setTimeoutInSeconds(20);

>         try {
>             SeleniumServer seleniumServer = new SeleniumServer(true, rc);
>             seleniumServer.boot();
>             seleniumServer.start();
>             seleniumServer.getPort();

>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>         return hubURL;
>     }
> }

> This is the output I see in the console:

> [TestNG] Running:
>   C:\Documents and Settings\gabell\.IntelliJIdea11\system\temp-testng-customsuite.xml

> log4j:WARN No appenders could be found for logger (org.browsermob.proxy.jetty.util.Container).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
> INFO 03/27 09:27:43 o.o.s.r.s.DriverSer~ - Executing: [new session: {platform=ANY, browserName=chrome, proxy={httpProxy=LP-IT-HC2-1210.inh..., version=, chrome.switches=[--start-maximized, --disable...}] at URL: /session)
> Started ChromeDriver
> port=33095
> version=18.0.1022.0
> log=C:\Java\workspace\Automation\chromedriver.log
> INFO 03/27 09:27:44 o.o.s.r.s.DriverSer~ - Done: /session
> INFO 03/27 09:27:44 o.o.s.r.s.DriverSer~ - Executing: org.openqa.selenium.remote.server.handler.GetSessionCapabilities@19c98d3 at URL: /session/1332840462378)
> INFO 03/27 09:27:44 o.o.s.r.s.DriverSer~ - Done: /session/1332840462378
> INFO 03/27 09:27:44 o.o.s.r.s.DriverSer~ - Executing: [get: http://www.paddypower.com/bet] at URL: /session/1332840462378/url)
> INFO 03/27 09:31:17 o.o.s.r.s.DriverSer~ - Done: /session/1332840462378/url
> 216069 [main] INFO  com.paddypower.reporter.Reporter  -

> ===============================================
> Custom suite
> Total tests run: 1, Failures: 0, Skips: 0
> ===============================================

> Process finished with exit code 0

> I've attached the resulting Har though I'm not sure you'll be able to access it.

> On 26 March 2012 19:21, Patrick Lightbody <patr...@lightbody.net> wrote:
> Thanks let me know.

> --
> Patrick Lightbody
> +1 (415) 830-5488

> On Mar 26, 2012, at 11:20 AM, Graham Abell wrote:

>> The IDE project shouldn't be a problem, the URL is internal but I'll verify the same thing happens with our production site in the  morning which is www.paddypower.com

>> On 26 March 2012 19:18, Patrick Lightbody <patr...@lightbody.net> wrote:
>> OK, I need the URL you're trying to hit and also if you can share a stripped down version of the IDE project (sans all your proprietary stuff, hopefully you can still recreate the issue).

>> --
>> Patrick Lightbody
>> +1 (415) 830-5488

>> On Mar 26, 2012, at 11:09 AM, Graham Abell wrote:

>>> Hi Patrick,

>>> Yes, slow via the IDE while using BMP programmatically. It runs fine via the binary implementation.

>>> graham

>>> On 26 March 2012 19:06, Patrick Lightbody <patr...@lightbody.net> wrote:
>>> Graham,
>>> Is that still when only running it in your IDE? Does the page load fast when going through BMP running in the standard binary distribution?

>>> Patrick

>>> --
>>> Patrick Lightbody
>>> +1 (415) 830-5488

>>> On Mar 26, 2012, at 2:54 AM, Graham wrote:

>>>> Hi Patrick,

>>>> I didn't see the latest beta-6 in the public repo when I originally looked, I can see it there now so I've reverted to that version in the public repo.

>>>> I've rerun my test and I'm still seeing very slow load times [~3 minutes] though images are being displayed now. The page loads in about 3 seconds if I go direct without using BrowserMob.

>>>> Any thoughts?

>>>> thanks,
>>>> Graham

>>>> On Friday, 23 March 2012 05:15:29 UTC, Patrick Lightbody wrote:
>>>> Graham,
>>>> I'm not quite clear what your setup is. You're saying that you built the project from source and put it in to your own nexus repo. Did you include the pom as well, so that when you pull it back in all the dependencies are also pulled in? Also, we publish directly to the central maven repo, so any reasons you can't just that instead?

>>>> Patrick

>>>> --
>>>> Patrick Lightbody
>>>> +1 (415) 830-5488

>>>> On Mar 15, 2012, at 12:54 PM, Graham Abell wrote:

>>>>> We're using intellij. I've compiled the source locally and then added the jar into our nexus repo which is where my project is pulling it from.

>>>>> There more than likely is some ssl on the page, is there a way I can tell whether the resources are loading?

>>>>> On 15 March 2012 19:52, Patrick Lightbody <patr...@lightbody.net> wrote:
>>>>> Does the URL that you're hitting contain any SSL? Wondering if maybe the way you're launching it in you IDE might not be pulling in the resources from src/main/resources, which contains the sslSupport directory and other files necessary to operate. What IDE are you using?

>>>>> --
>>>>> Patrick Lightbody
>>>>> +1 (415) 830-5488

>>>>> On Mar 15, 2012, at 10:28 AM, Graham wrote:

>>>>>> all,

>>>>>> I'm having a funny issue.

>>>>>> I've taken the latest code from github and compiled it locally.

>>>>>> I try to create and access a proxy via selenium like the example
>>>>>> provided:
>>>>>> ProxyServer server = new ProxyServer(4444);
>>>>>> server.start();

>>>>>> // get the Selenium proxy object
>>>>>> Proxy proxy = server.seleniumProxy();

>>>>>> // configure it as a desired capability
>>>>>> DesiredCapabilities capabilities = new DesiredCapabilities();
>>>>>> capabilities.setCapability(​CapabilityType.PROXY, proxy);

>>>>>> When I then navigate to a url with my WebDriver it takes forever and
>>>>>> all the images etc are missing from the page.

>>>>>> In and effort to debug I then ran the binary version, created a new
>>>>>> proxy via the REST api and then set this in my browser. This worked
>>>>>> perfectly, page loaded reasonably quickly and all the assets were
>>>>>> there. I did see some errors in relation to google analytics and
>>>>>> facebook but this will be due to the fact we have a corporate firewall
>>>>>> and I'd need to set an upstream proxy and I wasn't sure how to do that
>>>>>> via REST.

>>>>>> any ideas?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.