Comments (7)
Can you provide more details?
A simple complete case is always helpful.
from htmlunit-driver.
The simplest thing I could come up with which is not project related is a google search. I bet it can be replaced by simple requests on any other web page.
I started the attached program with VM arguments '-Xmx10g'. After 5 minutes, the 7GB of old gen space were full. After 7 minutes, the garbage collector activity didn't drop under 90% any more.
from htmlunit-driver.
Attachment didn't work, here is the code:
import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class Main {
public static void main(final String[] args) throws InterruptedException {
int numberOfThreads = 25;
ExecutorService executor = Executors.newFixedThreadPool(numberOfThreads);
for (int i = 0; i < numberOfThreads; i++) {
executor.execute(new TestRunner(i));
}
executor.shutdown();
executor.awaitTermination(10, TimeUnit.MINUTES);
}
private static class TestRunner implements Runnable {
private static final Random RANDOM = new Random();
private static final char FIRST = ' ';
private static final char LAST = '~';
private final int id;
public TestRunner(final int id) {
this.id = id;
}
@Override
public void run() {
HtmlUnitDriver driver = new HtmlUnitDriver(false);
for (int i = 0; i < 1000; i++) {
driver.get("https://www.google.de/");
String searchString = getRandomSearchString();
WebElement input = new WebDriverWait(driver, 1).until(ExpectedConditions.elementToBeClickable(By.name("q")));
input.sendKeys(getRandomSearchString() + Keys.RETURN);
int resultcount = driver.findElements(By.xpath("//div[@id='rso']/div/div/div[@class='g']")).size();
System.out.println("Thread " + id + " returned " + resultcount + " results for searchstring " + searchString);
}
}
private String getRandomSearchString() {
// use between 10 and 20 chars
int numberOfChars = RANDOM.nextInt(11) + 10;
StringBuilder sb = new StringBuilder(10);
for (int i = 0; i < numberOfChars; i++) {
// use chars from space ' ' up to tilde '~'
char c = (char) (RANDOM.nextInt(LAST - FIRST + 1) + FIRST);
sb.append(c);
}
return sb.toString();
}
}
}
from htmlunit-driver.
Is there any further information I can provide to track this issue down?
from htmlunit-driver.
Hope this is fixed. Please try with the latest snapshot.
from htmlunit-driver.
I tested the 2.29-SNAPSHOT of htmlunit driver and didn't run into any memory problems any more.
I encountered some performance issues which I couldn't track down and may be caused by the fact that I couldn't find an perfectly working Selenium version for this snapshot. But this very issue here can be regarded as closed.
from htmlunit-driver.
Thanks for the feedback. Feel free to open a new issue if you think there is a new performance problem.
from htmlunit-driver.
Related Issues (20)
- Driver not switching tabs and windows HOT 3
- NoSuchMethodError after quitting or closing driver and then re-calling it? HOT 6
- Angular support for htmlunitdriver ? HOT 1
- Breaking API changes in 4.8.1 HOT 9
- getDomProperty("value") does return "null" whereas getAttribute("value") returns a value HOT 9
- Selenium driver HOT 1
- Test HOT 1
- To ignore - Error during JavaScript execution HOT 3
- How to setting proxy authorization with username/passwd in ubuntu-server 18.04 env HOT 8
- org.htmlunit.ScriptException: SyntaxError: Empty JSON string HOT 9
- HtmlUnitDriver needs to provide WebDriverInfo and DriverService service providers for Selenium 4 Grid HOT 4
- Searching with RelativeLocator does not work HOT 3
- Threading problem when using multiple frames
- Implement HasAuthentication to be able to use authentication HOT 1
- elem.getAttribute("src") should return an empty string if no src attribute is present
- elem.getAttribute("xxx") should return null if no 'xxx' attribute is present
- XPath Not Working Via document.evaluate HOT 4
- Rhino not compiling any JavaScript when ScriptException encountered HOT 7
- Runasync causing deadlock?
- Fetching innerHTML HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from htmlunit-driver.