我已经使用Selenium2 / WebDriver编写了测试,想要测试HTTP请求返回的HTTP 403 Forbidden状态。
使用Selenium WebDriver能否获取HTTP响应状态码?
我已经使用Selenium2 / WebDriver编写了测试,想要测试HTTP请求返回的HTTP 403 Forbidden状态。
使用Selenium WebDriver能否获取HTTP响应状态码?
HttpURLConnection c= (HttpURLConnection)new
URL("https://www.google.com")
.openConnection();
// set the HEAD request with setRequestMethod
c.setRequestMethod("HEAD");
// connection started and get response code
c.connect();
int r = c.getResponseCode();
System.out.println("Http response code: " + r);
webdriver
的限制,这些限制对Python和Java都是相同的;) - maxkoryukov