要使用所有正确的“等待”编写高质量的Selenium测试,我目前正在强迫Web应用程序运行得更慢:
public class SlowLoadingFilter implements Filter {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
throw new ServletException("SlowLoadingFilter sleep failed", e);
}
filterChain.doFilter(servletRequest, servletResponse);
}
我想知道Tomcat或Jetty是否有正确的方法,或者这是唯一的方法吗?