Skip to content

HtmlSubmitButton sometimes returns a TextPage #144

@kai83

Description

@kai83

Î have a question where I could need some guidance on how to investigate it.
Following problem:
I am loading an HTMLpage and trying to locate the submit button.
This works fine, and also the click is working.

But sometimes, maybe from 1000 times, 50 times it is failing to load the next page.
In this case, I am getting an empty textpage back.

Thats how I initialize the webclient:

webClient = new WebClient(browser);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setPrintContentOnFailingStatusCode(false);
webClient.getOptions().setUseInsecureSSL(true);
webClient.setJavaScriptTimeout(15000);
webClient.getOptions().setTimeout(90000);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());

So nothing really special.
This is how I submit the button.
Page page = submitBtn.click()

Strange is, if I use Wireshark then you can see, that there is no response on the HTTP POST.
So no idea where the empty text page is coming from.

Its also difficult t reproduce, I have the general feeling that this occurs on slow network connections.

But now the strange part.
In case I receive the "TextPage", then I make a refresh.
But the refresh is changing from a POST to the URL to GET to the URL.
So I am not even really "refreshing" with the old properties.

Is there a way I can submit the old POST request again in case a TextPage is returned?
Or any idea why HtmlUnit returns a textpage whilest Wireshark has no data after the Post?
The page is returned in the same second when the POST is executed...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions