Hello,
I'm trying to create a bot with HtmlUnit to get some products from a site automatically, I'm getting the products listed, but the site has several branches and for me to change to the branch I want, I need to change the value of one select and click a button, but after I click the button, I have the same page as before, it does not change anything and it does not return any error or warning, does anyone give me a hand?
final HtmlPage page = webClient.getPage("url");
final HtmlSelect select = (HtmlSelect) page.getElementById("s-ch-select-city");
select.setSelectedAttribute("8", true);
ScriptResult resultFinal = page.executeJavaScript("javascript:document.getElementById('s-ch-change-channel').click()");
webClient.waitForBackgroundJavaScript(10000);
webClient.waitForBackgroundJavaScriptStartingBefore(10000);
synchronized (page) {
page.wait(10000);
}
Page pageResultFinal = resultFinal.getNewPage();
HtmlPage pageCascavel = ((HtmlPage) pageResultFinal);
This is the part of the code in which I try to change the value and click the button, generating me a new page!