@Test public void submittingForm() throws Exception { final WebClient webClient = new WebClient(); // Get the first page final HtmlPage page1 = webClient.getPage("http://some_url"); // Get the form that we are dealing with and within that form, // find the submit button and the field that we want to change. final HtmlForm form = page1.getFormByName("myform"); final HtmlSubmitInput button = form.getInputByName("submitbutton"); final HtmlTextInput textField = form.getInputByName("userid"); // Change the value of the text field textField.setValueAttribute("root"); // Now submit the form by clicking the button and get back the second page. final HtmlPage page2 = button.click(); webClient.closeAllWindows(); }
HtmlForm form = page.getFormByName("sendSmsForm"); form.getInputByName("list").setValueAttribute("99999999"); form.getInputByName("message1").setValueAttribute("test"); page = (HtmlPage) page.executeJavaScript("checkBeforeSubmit()").getNewPage(); // from onsubmit page = (HtmlPage) page.executeJavaScript("sendSMS()").getNewPage(); //from submit link
WebClient webClient = new WebClient(); HtmlPage page = webClient.getPage("http://some_host/test.html"); HtmlForm form = page.getForms().get(0); form.getInputByName("username").setValueAttribute(username); form.getInputByName("password").setValueAttribute(password); form.getInputByName("pict_to").setValueAttribute("0"); form.getInputByName("pict_type").setValueAttribute("0"); form.getInputByName("pict").setValueAttribute("full_path_to_captcha_png"); form.<HtmlFileInput>getInputByName("pict").setContentType("image/png");//optional HtmlPage page2 = form.getInputByValue("Send").click();
HtmlForm form = page.getFormByName("a_form"); HtmlHiddenInput formToken = form.getInputByName("form_token"); formToken.setValueAttribute("form_token_value"); /* Or without the variable: */ form.getInputByName("creation_time").setValueAttribute("creation_time_value"); HtmlSubmitInput submitInput = form.getInputByName("post"); submitInput.click();
HtmlPage page = (HtmlPage) webClient.getPage("https:website name.com/loginpage"); HtmlForm form = page.getFormBy("login_form"); HtmlForm formm= page.getForms().get(0); formm.getInputByName("SignInEmailAddress").setValueAttribute("your emailid"); formm.getInputByName("SignInPassword").setValueAttribute("password"); page = (HtmlPage) formm.getInputByValue("Login").click(); System.out.println(page); System.out.println(page.asText());
HtmlPage page3; page3 = webClient.getPage("Website"); HtmlForm loginForm = page3.getFormByName("loginForm"); HtmlTextInput username = loginForm.getInputByName("NameofUsernameElement"); HtmlPasswordInput pass = loginForm.getInputByName("NameofPassowordElement"); HtmlSubmitInput b = loginForm.getInputByValue("LoginButtonValue"); username.setValueAttribute("Actualy Username"); pass.setValueAttribute("Actual Password"); HtmlPage page2; page2 = b.click();
final WebClient webClient = new WebClient(); final HtmlPage page1 = webClient.getPage("http://www.facebook.com"); final HtmlForm form = page1.getFormByName("login_form"); final HtmlSubmitInput button = form.getInputsByValue("Log in"); final HtmlTextInput textField = form.getInputByName("email"); textField.setValueAttribute("jon@jon.com"); final HtmlTextInput textField = form.getInputByName("pass"); textField.setValueAttribute("ahhhh"); final HtmlPage page2 = button.click();
/** * Logs in to Hudson. */ public WebClient login(String username, String password) throws Exception { HtmlPage page = goTo("/login"); // page = (HtmlPage) page.getFirstAnchorByText("Login").click(); HtmlForm form = page.getFormByName("login"); form.getInputByName("j_username").setValueAttribute(username); form.getInputByName("j_password").setValueAttribute(password); form.submit(null); return this; }
public void submittingForm() throws Exception { WebClient webClient = new WebClient(); HtmlPage page1 = webClient.getPage("http://some_url"); HtmlForm form = page1.getFormByName("myform"); HtmlSubmitInput button = form.getInputByName("submitbutton"); HtmlTextInput textField = form.getInputByName("userid"); textField.setValueAttribute("root"); HtmlPage page2 = button.click(); }
/** * Logs in to Hudson. */ public WebClient login(String username, String password) throws Exception { HtmlPage page = goTo("/login"); // page = (HtmlPage) page.getFirstAnchorByText("Login").click(); HtmlForm form = page.getFormByName("login"); form.getInputByName("j_username").setValueAttribute(username); form.getInputByName("j_password").setValueAttribute(password); form.submit(null); return this; }
/** * Logs in to Hudson. */ public WebClient login(String username, String password) throws Exception { HtmlPage page = goTo("/login"); // page = (HtmlPage) page.getFirstAnchorByText("Login").click(); HtmlForm form = page.getFormByName("login"); form.getInputByName("j_username").setValueAttribute(username); form.getInputByName("j_password").setValueAttribute(password); form.submit(null); return this; }
final WebClient webClient = new WebClient(); final HtmlPage page1 = webClient.getPage("http://www.facebook.com"); final HtmlForm form = page1.getFormByName("login_form"); final HtmlSubmitInput button = form.getInputsByValue("Log in"); final HtmlTextInput textField = form.getInputByName("email"); textField.setValueAttribute("youremailaddress@domain.com"); final HtmlTextInput textField = form.getInputByName("pass"); textField.setValueAttribute("yourPassword"); final HtmlPage page2 = button.click();
final WebClient webClient = new WebClient(); final HtmlPage page1 = webClient.getPage("http://www.facebook.com"); final HtmlForm form = (HtmlForm) page1.getElementById("login_form"); final HtmlSubmitInput button = (HtmlSubmitInput) form.getInputsByValue("Log In").get(0); final HtmlTextInput textField = form.getInputByName("email"); textField.setValueAttribute("jon@jon.com"); final HtmlPasswordInput textField2 = form.getInputByName("pass"); textField2.setValueAttribute("ahhhh"); final HtmlPage page2 = button.click();
public HtmlPage search(String q) throws IOException, SAXException { HtmlPage top = goTo(""); HtmlForm search = top.getFormByName("search"); search.getInputByName("q").setValueAttribute(q); return (HtmlPage)search.submit(null); }
@Override protected String getCallbackUrl(final HtmlPage authorizationPage) throws Exception { final HtmlForm form = authorizationPage.getForms().get(0); final HtmlTextInput email = form.getInputByName("email"); email.setValueAttribute("testscribeup@gmail.com"); final HtmlPasswordInput password = form.getInputByName("pass"); password.setValueAttribute("testpwdscribeup"); final HtmlSubmitInput submit = form.getInputByName("login"); final HtmlPage callbackPage = submit.click(); final String callbackUrl = callbackPage.getUrl().toString(); logger.debug("callbackUrl : {}", callbackUrl); return callbackUrl; }
public HtmlPage search(String q) throws IOException, SAXException { HtmlPage top = goTo(""); HtmlForm search = top.getFormByName("search"); search.getInputByName("q").setValueAttribute(q); return (HtmlPage)HtmlFormUtil.submit(search, null); }
public HtmlPage search(String q) throws IOException, SAXException { HtmlPage top = goTo(""); HtmlForm search = top.getFormByName("search"); search.getInputByName("q").setValueAttribute(q); return (HtmlPage) search.submit(null); }
public HtmlPage search(String q) throws IOException, SAXException { HtmlPage top = goTo(""); HtmlForm search = top.getFormByName("search"); search.getInputByName("q").setValueAttribute(q); return (HtmlPage)search.submit(null); }
protected void setInputValue(HtmlPage htmlPage, HtmlForm htmlForm, String inputId, String value) { try { htmlForm.getInputByName(inputId).setValueAttribute(value); } catch (ElementNotFoundException e) { ((HtmlInput)htmlPage.getElementById(inputId)).setValueAttribute(value); } }
public void testMainFeature() throws Exception { WebClient wc = new WebClient(); HtmlPage page = wc.getPage(new URL(url, "/form.html")); HtmlForm f = page.getFormByName("main"); f.getInputByName("json").setValueAttribute("{\"first\":\"Kohsuke\",\"last\":\"Kawaguchi\"}"); f.submit(); }