0

atm i´m working on a "hobby-project" with the private communication tool Wire. https://app.wire.com/auth/#login

I tried to log on my Wire-Account with HTML UNIT. I "think" i got some code-problem with the Login-Button. Below I've attached the full code.

public static void submittingForm() throws Exception {

    //webClient Options

    final WebClient webClient = new WebClient(BrowserVersion.CHROME);
    webClient.getOptions().setRedirectEnabled(true);
    webClient.getOptions().setThrowExceptionOnScriptError(false);
    webClient.getOptions().setCssEnabled(false);
    webClient.getOptions().setUseInsecureSSL(true);
    webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
    webClient.getCookieManager().setCookiesEnabled(true);
    webClient.getOptions().setJavaScriptEnabled(false);


    // Load HtmlPage

    final HtmlPage page1 = webClient.getPage("https://app.wire.com/auth/#login");
    System.out.println(page1.getTitleText());
    System.out.println(page1.getForms());

    // Load Form.
    HtmlForm form = page1.getFirstByXPath("//form[@id='login-method-password']");


    // Login-Data

    HtmlTextInput usernameInput = page1.getHtmlElementById("wire-login-username");
    usernameInput.setValueAttribute("blibalub@bli.de");
    System.out.println(usernameInput.getValueAttribute());

    HtmlPasswordInput passwordInput = page1.getHtmlElementById("wire-login-password");
    passwordInput.setText("bliablubi");
    System.out.println(passwordInput.getValueAttribute());

    DomElement button = (DomElement) form.getFirstByXPath("//*[@id='wire-password-login']");
    HtmlPage page2 = (HtmlPage) button.click();
    System.out.println(page2.getForms());  // HERE same output like above page1

}

Code seems to work but page1 and page2 are the same.

Here is a "Warning" Output:

*PM com.gargoylesoftware.htmlunit.html.InputElementFactory createElementNS
INFORMATION: Bad input type: "tel", creating a text input*
BiFi
  • 19
  • 3

1 Answers1

0
  • use the latest version of HtmlUnit - the input type tel should be supported with the latest release; if you still get this warning open an issue
  • as many modern pages this login use javascript as essential part of the login process; you have to enable js

    webClient.getOptions().setJavaScriptEnabled(true);

RBRi
  • 2,704
  • 2
  • 11
  • 14
  • - Thanks, really used a old version. - For everybody working on a same project look at this [AvoidErrors](http://stackoverflow.com/questions/3600557/turning-htmlunit-warnings-off/18563576#18563576.). – BiFi Mar 10 '17 at 10:34
  • Any Hints of "targeting" the Button and click him? – BiFi Mar 11 '17 at 13:09