@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(); }
/** * Hits the Hudson system configuration and submits without any modification. */ protected void configRoundtrip() throws Exception { submit(createWebClient().goTo("configure").getFormByName("config")); }
/** * Loads a configuration page and submits it without any modifications, to * perform a round-trip configuration test. * <p> * See http://wiki.hudson-ci.org/display/HUDSON/Unit+Test#UnitTest-Configurationroundtriptesting */ protected <P extends Job> P configRoundtrip(P job) throws Exception { submit(createWebClient().getPage(job,"configure").getFormByName("config")); return job; }
/** * Hits the Hudson system configuration and submits without any modification. */ public void configRoundtrip() throws Exception { submit(createWebClient().goTo("configure").getFormByName("config")); }
/** * Loads a configuration page and submits it without any modifications, to * perform a round-trip configuration test. * <p> * See http://wiki.jenkins-ci.org/display/JENKINS/Unit+Test#UnitTest-Configurationroundtriptesting */ protected <P extends Job> P configRoundtrip(P job) throws Exception { submit(createWebClient().getPage(job,"configure").getFormByName("config")); return job; }
private HtmlForm getForm(String nameOrID) { try { return (HtmlForm) ((HtmlPage) win.getEnclosedPage()) .getHtmlElementById(nameOrID); } catch (ElementNotFoundException e) { } try { return ((HtmlPage) win.getEnclosedPage()).getFormByName(nameOrID); } catch (ElementNotFoundException e) { } return null; }
protected <P extends Item> P configRoundtrip(P job) throws Exception { submit(createWebClient().getPage(job,"configure").getFormByName("config")); return job; }
protected <C extends ComputerConnector> C configRoundtrip(C before) throws Exception { computerConnectorTester.connector = before; submit(createWebClient().goTo("self/computerConnectorTester/configure").getFormByName("config")); return (C) computerConnectorTester.connector; }
/** * Loads a configuration page and submits it without any modifications, to * perform a round-trip configuration test. <p> See * http://wiki.hudson-ci.org/display/HUDSON/Unit+Test#UnitTest-Configurationroundtriptesting */ protected <P extends Job> P configRoundtrip(P job) throws Exception { submit(createWebClient().getPage(job, "configure").getFormByName("config")); return job; }
/** * Loads a configuration page and submits it without any modifications, to * perform a round-trip configuration test. * <p> * See http://wiki.hudson-ci.org/display/HUDSON/Unit+Test#UnitTest-Configurationroundtriptesting */ protected <P extends Job> P configRoundtrip(P job) throws Exception { submit(createWebClient().getPage(job,"configure").getFormByName("config")); return job; }
/** * Hits the Hudson system configuration and submits without any modification. */ protected void configRoundtrip() throws Exception { submit(createWebClient().goTo("configure").getFormByName("config")); }
/** * Hits the Hudson system configuration and submits without any * modification. */ protected void configRoundtrip() throws Exception { submit(createWebClient().goTo("configure").getFormByName("config")); }
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); }
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();
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(); }
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();
/** * 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; }
private HtmlPage restartFromStageInUI(@Nonnull WorkflowRun original, @Nonnull String stageName) throws Exception { RestartDeclarativePipelineAction action = original.getAction(RestartDeclarativePipelineAction.class); assertNotNull(action); assertTrue(action.isRestartEnabled()); HtmlPage page = j.createWebClient().getPage(original, action.getUrlName()); HtmlForm form = page.getFormByName("restart"); HtmlSelect select = form.getSelectByName("stageName"); select.getOptionByValue(stageName).setSelected(true); return j.submit(form); }