3

I am working on a video consultation application where I need three separate windows to remain open simultaneously for a test case.

I am using keyword driven framework using java with selenium and following code to open up new instances of chrome every time:

public static void OPEN_BROWSER(String object,String data){     
    Log.info("OPENS NEW BROWSER");
    try{                
            System.setProperty("webdriver.chrome.driver",     "C:/chromedriver.exe"); 

            ChromeOptions options = new ChromeOptions();

            options.addArguments("use-fake-device-for-media-stream");

            options.addArguments("use-fake-ui-for-media-stream");
            DesiredCapabilities capabilities = DesiredCapabilities.chrome();
            capabilities.setCapability("chrome.binary","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe");

            capabilities.setCapability(ChromeOptions.CAPABILITY, options);

            driver = new ChromeDriver(capabilities);

             Log.info("Chrome browser started");
             System.out.println("Chrome browser started");
        }catch (Exception e){
        Log.info("Not able to open the Browser --- " + e.getMessage());
        System.out.println("Not able to open the Browser --- " + e.getMessage());
        DriverScript.bResult = false;
    }

public static void GOTO_URL(String object, String data){
    try{
        Log.info("Navigating to URL");
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.get(data);
        //driver.navigate().to(data);
        Log.info("Chrome browser started");
    }catch(Exception e){
        Log.info("Not able to navigate --- " + e.getMessage());
        System.out.println("Not able to navigate --- " + e.getMessage());
        DriverScript.bResult = false;
        }
    }

The problem is every time I am trying to call GOTO_URL function, since a new webdriver is launched from OPEN_BROWSER function , it takes more than 5 minutes to load a URL and even more in some cases.

Any help would be really appreciated.

  • Have checked opening url manually? – QAMember Jul 22 '15 at 6:05
  • yes, manually its working absolutely fine. – Annu Jul 22 '15 at 6:10
1

From https://stackoverflow.com/questions/16179808/chromedriver-is-extremely-slow-on-a-specific-machine-using-selenium-grid-and-ne

Turn off automatic proxy detection:

chromeOptions.Proxy = null; // Or similar
0

I like the answer, but it didn't explain everything. Didn't know that I need to create a ChromeOptions object then change the proxy to null. Here is my code that solved the problem:

        string driverPath = @"C:\where ever the driver it\";
        var chromeOptions = new ChromeOptions();
        chromeOptions.Proxy = null;
        IWebDriver browser = new ChromeDriver(driverPath, chromeOptions);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.