browsermob with selenium firefoxdriver issue

1.7k views Asked by At

public class PerfTestt {

public static void main(String[] args) throws Exception {



    ProxyServer server = new ProxyServer(8080);
    server.start();



    Proxy proxy = server.seleniumProxy();

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.PROXY, proxy);

    WebDriver driver = new FirefoxDriver(capabilities);

    server.newHar("yahoo.com");

    driver.get("http:/yahoo.com");



    Har har = server.getHar();
    FileOutputStream fos = new FileOutputStream("C:\\Users\\nergiz\\output.txt");
    har.writeTo(fos);
    server.stop();
    driver.quit();
}

}

Driver info: driver.version: FirefoxDriver at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118) at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:251) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:110) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:195) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:190) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:107) at com.beam.testo.selenium.PerfTestt.main(PerfTestt.java:32) Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms.

1

There are 1 answers

0
Tester On

I solved. I was getting failre a browser options. I edit my codes:

            String PROXY = "localhost:8080";

    ProxyServer server = new ProxyServer(8080);
    server.start();

    Proxy proxy = server.seleniumProxy();
    proxy.setHttpProxy(PROXY).setFtpProxy(PROXY).setSslProxy(PROXY);

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.PROXY, proxy);

    WebDriver driver = new FirefoxDriver(capabilities);

    server.newHar("yahoo.com");

    driver.get("http://yahoo.com");


    Har har = server.getHar();
FileOutputStream fos = new                           FileOutputStream("C:\\Users\\ner\\output.txt");
    har.writeTo(fos);
    server.stop();
    driver.quit();