refactor htmlunit and httpclient page function.