Skip to content

How to get pop-up window in htmlunit ? #243

@diaowenyang

Description

@diaowenyang

I use the following code:

HtmlPage page1 = webClient.getPage("https://***");
HtmlForm form = page1.getFormByName("form");
HtmlTextInput user = form.getInputByName("User");
user.setValueAttribute("username");
HtmlPasswordInput pwd = form.getInputByName("Pwd1");
pwd.setValueAttribute("password");
HtmlParagraph paragraph = (HtmlParagraph) page1.getByXPath("//p[@class='txt_center b_mrgn9 t_mrgn9']").get(0);
DomElement dom = paragraph.getFirstElementChild();
HtmlPage page2 = dom.click();
log.info("page2网页html:{}", page2.asXml());

page2 is same as page1.
In actual operation, after clicking the submit button, a new window pops up. How do I get the information of the pop-up window?

Thanks a lot!

WechatIMG407

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