html访问页面,怎么设置停留时间

页面停留时间,是根据操作才会有的,操作有了,没有停留时间,
WebClient webClient = new WebClient(BrowserVersion.FIREFOX_38,ip,port);
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setCssEnabled(false);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.getOptions().setTimeout(15000);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
HtmlPage rootPage= webClient.getPage(url);

使用定时器就可以,前端有定时器函数,你可以上网似乎搜

setTimeout可以停留时间执行一次 多次可以用setInterval

如果你是想要页面渲染完成后,停留多长时间然后跳转其他页面,用楼上说的定时器就能完成,但是你如果想要监控用户操作,可以写一个轮询,用户操作就终止轮询

setTimeout设置几秒后关闭页面

你现在缺一个开启页面的函数5
time = setInterval(function(){
window.open("http://www.baidu.com");
},5000);
关闭定时函数
function stop(){
clearInterval(time);
}

你现在缺一个开启页面的函数5
time = setInterval(function(){
window.open("http://www.baidu.com");
打开新窗口的同时关闭本窗口
window.close()
},5000);
关闭定时函数
function stop(){
clearInterval(time);
}