atm Ich arbeite an einem "Hobby-Projekt" mit dem privaten Kommunikationstool Draht. https://app.wire.com/auth/#loginHTML EINHEIT Login Probleme/Button
Ich habe versucht, meinen Wire-Account mit HTML UNIT anzumelden. Ich denke "ich habe ein Code-Problem mit dem Login-Button. Im Folgenden habe ich den vollständigen Code beigefügt.
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("[email protected]");
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 scheint zu funktionieren, aber Seite1 und Seite2 sind identisch.
Hier ist eine „Warnung“ Ausgabe:
*PM com.gargoylesoftware.htmlunit.html.InputElementFactory createElementNS
INFORMATION: Bad input type: "tel", creating a text input*
- Danke, wirklich eine alte Version verwendet. - Für alle, die an einem Projekt arbeiten, schauen Sie sich [AvoidErrors] an (http://stackoverflow.com/questions/3600557/turning-htmlunit-warnings-off/18563576#18563576.). – BiFi
Irgendwelche Hinweise darauf, den Button zu "targetieren" und auf ihn zu klicken? – BiFi