HtmlPage open1 = (HtmlPage) webClient.getPage("http://www.google.com");
ScriptResult result = open1.executeJavaScript("window.location.assign('https://www.google.com.tr/search?q'));
HtmlPage afterExecution = (HtmlPage) result.getNewPage();
System.out.println(afterExecution); //in window new adres
如何在同一窗口中打开新网站?
答案 0 :(得分:0)
只需致电webClient.getPage("https://www.google.com.tr/search?q");
。你不需要调用任何javascript。
来自javadocs:
构建URL并将其加载到当前URL的便捷方法 WebWindow将由getPage(WebWindow,WebRequest)完成。