webWindow.getWebClient().download(webWindow, "", request, true, false, "JS set location");
webWindow.getWebClient().download(webWindow, "", request, true, false, "JS set location");
target = page.getResolvedTarget(getTargetAttribute()); page.getWebClient().download(page.getEnclosingWindow(), target, webRequest, true, false, "Link click");
target = page.getResolvedTarget(getTargetAttribute()); page.getWebClient().download(page.getEnclosingWindow(), target, webRequest, true, false, "Link click");
/** * Reloads the current page, possibly forcing retrieval from the server even if * the browser cache contains the latest version of the document. * @param force if {@code true}, force reload from server; otherwise, may reload from cache * @throws IOException if there is a problem reloading the page * @see <a href="http://msdn.microsoft.com/en-us/library/ms536342.aspx">MSDN Documentation</a> */ @JsxFunction public void reload(final boolean force) throws IOException { final HtmlPage htmlPage = (HtmlPage) getWindow(getStartingScope()).getWebWindow().getEnclosedPage(); final WebRequest request = htmlPage.getWebResponse().getWebRequest(); String referer = htmlPage.getUrl().toExternalForm(); request.setAdditionalHeader(HttpHeader.REFERER, referer); referer = UrlUtils.getUrlWithNewQuery(htmlPage.getUrl(), null).toExternalForm(); referer = StringUtils.stripEnd(referer, "/"); request.setAdditionalHeader(HttpHeader.ORIGIN, referer); final WebWindow webWindow = window_.getWebWindow(); webWindow.getWebClient().download(webWindow, "", request, true, false, "JS location.reload"); }
/** * Reloads the current page, possibly forcing retrieval from the server even if * the browser cache contains the latest version of the document. * @param force if {@code true}, force reload from server; otherwise, may reload from cache * @throws IOException if there is a problem reloading the page * @see <a href="http://msdn.microsoft.com/en-us/library/ms536342.aspx">MSDN Documentation</a> */ @JsxFunction public void reload(final boolean force) throws IOException { final HtmlPage htmlPage = (HtmlPage) getWindow(getStartingScope()).getWebWindow().getEnclosedPage(); final WebRequest request = htmlPage.getWebResponse().getWebRequest(); String referer = htmlPage.getUrl().toExternalForm(); request.setAdditionalHeader(HttpHeader.REFERER, referer); referer = UrlUtils.getUrlWithNewQuery(htmlPage.getUrl(), null).toExternalForm(); referer = StringUtils.stripEnd(referer, "/"); request.setAdditionalHeader(HttpHeader.ORIGIN, referer); final WebWindow webWindow = window_.getWebWindow(); webWindow.getWebClient().download(webWindow, "", request, true, false, "JS location.reload"); }
/** * Submits the form (at the end of the current script execution). */ @JsxFunction public void submit() { final HtmlPage page = (HtmlPage) getDomNodeOrDie().getPage(); final WebClient webClient = page.getWebClient(); final String action = getHtmlForm().getActionAttribute().trim(); if (StringUtils.startsWithIgnoreCase(action, JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { final String js = action.substring(JavaScriptURLConnection.JAVASCRIPT_PREFIX.length()); webClient.getJavaScriptEngine().execute(page, js, "Form action", 0); } else { // download should be done ASAP, response will be loaded into a window later final WebRequest request = getHtmlForm().getWebRequest(null); final String target = page.getResolvedTarget(getTarget()); final boolean forceDownload = webClient.getBrowserVersion().hasFeature(JS_FORM_SUBMIT_FORCES_DOWNLOAD); final boolean checkHash = !webClient.getBrowserVersion().hasFeature(FORM_SUBMISSION_DOWNLOWDS_ALSO_IF_ONLY_HASH_CHANGED); webClient.download(page.getEnclosingWindow(), target, request, checkHash, forceDownload, "JS form.submit()"); } }
/** * Submits the form (at the end of the current script execution). */ @JsxFunction public void submit() { final HtmlPage page = (HtmlPage) getDomNodeOrDie().getPage(); final WebClient webClient = page.getWebClient(); final String action = getHtmlForm().getActionAttribute().trim(); if (StringUtils.startsWithIgnoreCase(action, JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { final String js = action.substring(JavaScriptURLConnection.JAVASCRIPT_PREFIX.length()); webClient.getJavaScriptEngine().execute(page, js, "Form action", 0); } else { // download should be done ASAP, response will be loaded into a window later final WebRequest request = getHtmlForm().getWebRequest(null); final String target = page.getResolvedTarget(getTarget()); final boolean forceDownload = webClient.getBrowserVersion().hasFeature(JS_FORM_SUBMIT_FORCES_DOWNLOAD); final boolean checkHash = !webClient.getBrowserVersion().hasFeature(FORM_SUBMISSION_DOWNLOWDS_ALSO_IF_ONLY_HASH_CHANGED); webClient.download(page.getEnclosingWindow(), target, request, checkHash, forceDownload, "JS form.submit()"); } }
webClient.download(webWindow, target, request, checkHash, false, "JS form.submit()"); return htmlPage;
webClient.download(webWindow, target, request, checkHash, false, "JS form.submit()"); return htmlPage;