package Linkgap.Demo1;
import java.util.Iterator;
import java.util.logging.Level;
import org.json.JSONException;
import org.json.JSONObject;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.logging.LogEntries;
import org.openqa.selenium.logging.LogEntry;
import org.openqa.selenium.logging.LogType;
import org.openqa.selenium.logging.LoggingPreferences;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
public class TestResponseCode
{
@Test
public void demo1()
{
// simple page (without many resources so that the output is
// easy to understand
String url = "http://www.w3school.com.cn/tiy/t.asp?f=ajax_httprequest_js_1";
DownloadPage(url);
}
private static void DownloadPage(String url)
{
ChromeDriver driver = null;
try
{
ChromeOptions options = new ChromeOptions();
// add whatever extensions you need
// for example I needed one of adding proxy, and one for blocking
// images
// options.addExtensions(new File(file, "proxy.zip"));
// op
selenium 获取请求状态码
最新推荐文章于 2024-06-19 12:54:04 发布