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
How do I open a new site in the same window?
just call webClient.getPage("https://www.google.com.tr/search?q");
. You don't need to call any javascript.
From the javadocs:
Convenient method to build an URL and load it into the current WebWindow as it would be done by getPage(WebWindow, WebRequest).