简体   繁体   中英

HtmlUnit StackOverflowError when submitting a form

I usually don't post this kind of questions, but this one is driving me crazy. I am using SeleniumWebDriver to filling a form and submitting it. I did this from my computer and it works perfectly, but when I upload the app to OpenShift I get a StackOverflowError when I submit the form. Here's the stacktrace:

[0m[31m04:29:06,529 ERROR [stderr] (Thread-110) Exception in thread "Thread-110" java.lang.StackOverflowError
[0m[31m04:29:06,542 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1311)
[0m[31m04:29:06,547 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1281)
[0m[31m04:29:06,547 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1286)
[0m[31m04:29:06,548 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1286)
[0m[31m04:29:06,548 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1286)
[0m[31m04:29:06,564 ERROR [stderr] (Thread-110)     at net.sourceforge.htmlunit.corejs.javascript.regexp.NativeRegExp.emitREBytecode(NativeRegExp.java:1286)

(he keeps going for a while but all the lines are the same...)

As you can see from the stacktrace, I am using HtmlUnit WebDriver. I googled this but I didn't find anybody with my exact problem, although it seems that HtmlUnit often gives StackOverflow errors...

Can anyone tell me if this is a bug or if am I missing something? Any help is really appreciated, thanks!

EDIT

Here's my code:

HtmlUnitDriver driver = new HtmlUnitDriver(BrowserVersion.CHROME);
driver.setJavascriptEnabled(true);
driver.get(myUrl);
//Finds the fields of the login form and fills it. Also removes the Remember me checkbox.
    WebElement email = driver.findElement(By.id("email"));
    email.clear(); 
    email.sendKeys(username);

    WebElement rememberMe = driver.findElement(By.name("persistent"));
    if(rememberMe.isSelected())rememberMe.click();

    WebElement pass = driver.findElement(By.id("pass"));
    pass.clear();
    pass.sendKeys(pass);

    //HERE IS WHERE THE ERROR OCCURS:
    pass.submit();

Instead of submit I've also tried to get the input manually from the button and click it like this:

    WebElement button = driver.findElement(By.id("u_0_2"));
    button.click();

but the problem is exactly the same...

Small gears have 512MB RAM and 1GB disk space each, so running such "resource intensive" applications might not be always possible and you might consider an upgrade to medium or large gear.

Also, trying to increase the stack size might be an option, see: How to increase the Java stack size?

You can check the Openshift Marketplace for monitoring cartridges.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM