bnz
bnz

Reputation: 37

Selenium RemoteWebDriver memory issues

I'm running a Selenium Standalone Server, version 2.25.0

I run a program in c# executing the driver by:

DesiredCapabilities capabilities = DesiredCapabilities.HtmlUnit();
capabilities.IsJavaScriptEnabled = false;
IWebDriver driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4444/wd/hub"), capabilities);

Then I collect some information via driver.FindElement(By.).

everything works fine.

After i executed all

I quit the driver by:

driver.Quit();

The test works fine. But when I take a look into the task-manager while executing I can see "java.exe" (the selenium server) grabbing memory and afterwards not releasing it.

How can i solve this problem? Any Ideas?

Upvotes: 1

Views: 2044

Answers (1)

eugene.polschikov
eugene.polschikov

Reputation: 7339

hmm.... comparing to my code:

public class BaseSeleniumTest extends SeleneseTestBase {
    static WebDriver driver;



    @BeforeClass
    public static void firefoxSetUp() throws MalformedURLException {

          DesiredCapabilities capability = DesiredCapabilities.firefox();


        driver = new RemoteWebDriver(new URL("http://192.168.4.52:4444/wd/hub"), capability);




        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
        driver.manage().window().setSize(new Dimension(1920, 1080));
    }
    @Before
    public void homePageRefresh() throws IOException {
        driver.get("login.base.url");
    }


    @AfterClass
    public static void closeFirefox(){
        driver.quit();
    }

.....
}

I do not have such memory issue. Grabbed memory was released. Could you provide the way you declare and initialize (creating instance) driver ?

enter image description here

Investigated a lil bit more: HtmlUnit appears to be leaking memory; what's the deal? Make sure (a) that you are using the latest version of HtmlUnit, and (b) that you are calling WebClient.closeAllWindows() when you are finished with your WebClient instance.

Taken from here

Upvotes: 1

Related Questions