SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
345 stars 195 forks source link

Getting Run time exception in Browsermob proxy #6364

Closed lukeis closed 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 6364


java.lang.RuntimeException: Bug extracting hudsuckr
    at org.openqa.selenium.browserlaunchers.WindowsProxyManager.extractHudsuckr(WindowsProxyManager.java:575)
    at org.openqa.selenium.browserlaunchers.WindowsProxyManager.runHudsuckr(WindowsProxyManager.java:585)
    at org.openqa.selenium.browserlaunchers.WindowsProxyManager.backupHudsuckrSettings(WindowsProxyManager.java:624)
    at org.openqa.selenium.browserlaunchers.WindowsProxyManager.backupRegistrySettings(WindowsProxyManager.java:286)
    at org.openqa.selenium.ie.InternetExplorerDriver.prepareProxy(InternetExplorerDriver.java:296)
    at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:180)
    at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:174)
    at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:147)
    at Test2.test2(Test2.java:40)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:128)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1203)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
    at org.testng.TestNG.run(TestNG.java:1036)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: java.io.IOException: Unable to locate: hudsuckr/hudsuckr.exe
    at org.openqa.selenium.io.FileHandler.locateResource(FileHandler.java:86)
    at org.openqa.selenium.io.FileHandler.copyResource(FileHandler.java:55)
    at org.openqa.selenium.browserlaunchers.WindowsProxyManager.extractHudsuckr(WindowsProxyManager.java:572)
    ... 32 more

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

Selenium version:2.33.0
OS:Win 7
Browser:IE 
Browser version:9

public void test2() throws Exception {

            String strFilePath = "C:\\Users\\310568\\Desktop\\Selenium2.0\\HarFiles\\log.har";

            // start the proxy
            ProxyServer server = new ProxyServer(4444);
            server.start();

            server.setCaptureHeaders(true);
            server.setCaptureContent(true);

             Proxy proxy = server.seleniumProxy();

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

            // start the browser up
             File file = new File("D:/SumaBackup/IEDriverServer.exe");
             System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
             WebDriver driver = new InternetExplorerDriver(capabilities);

            // create a new HAR with the label ""
            server.newHar("google");

            // open google.com
            driver.get("http://google.com");

            // get the HAR data
            Har har = server.getHar();
            FileOutputStream fos = new FileOutputStream(strFilePath);
            har.writeTo(fos);
            server.stop();
            driver.quit();

        }

Reported by marpurisuma on 2013-10-03 11:03:11

lukeis commented 8 years ago
Do you start your tests from Maven?

Reported by barancev on 2013-10-03 13:55:02

lukeis commented 8 years ago
yes Please find my pom.xml below

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>Selenium2.0</groupId>
    <artifactId>Selenium2.0</artifactId>
    <version>1.0</version>
    <dependencies>
        <dependency>
            <groupId>net.lightbody.bmp</groupId>
            <artifactId>browsermob-proxy</artifactId>
            <version>2.0-beta-8</version>
            <exclusions>
                <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpclient</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.2.3</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8.5</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.35.0</version>
        </dependency>
    </dependencies>
</project>

Reported by marpurisuma on 2013-10-04 05:43:29

lukeis commented 8 years ago
Should be fixed by revision e92c36306829
The fix will be included in 2.38 release

Reported by barancev on 2013-10-22 21:06:25

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 18:18:01