I am using HtmlUnit to navigate through the Web of knowledge web page. I am using the code below to set an option button so that results on the page would be sorted appropriately. Unfortunately, nothing happens when I execute the code. Results on the page remains sorted in the same way as they ware before.
HtmlSelect ssort = (HtmlSelect) pageX.getFirstByXPath("//*[@id=\'topNavBar\']/tbody/tr/td/form/select");
HtmlOption optionA = ssort.getOptionByValue("LC.D;PY.D;AU.A;SO.A;VL.D;PG.A");
I debuged the code and there is no errors. Do you have any idea what am I doing wrong?
As a general rule, functions like the
.setSelectedAttribute(HTMLOption, boolean)(See JavaDoc) will return a
HTMLPage that in most cases is the same as the current one, however in your case it will return a different
HTMLPage. So to capture the new page you just need to assign the return value to a
N.B: You could also use
getCurrentWindow() on the