获取 java.lang.NullPointerException ,而 运行 代码

Getting java.lang.NullPointerException , while running the code

public class TestMeetings extends Base_Page{

public static WebDriver admin, participant;
public ExtentHtmlReporter htmlReporter;
public ExtentReports extent;
public ExtentTest test;
File src;
FileInputStream objfile ;
Properties obj;
String url;
Robot r;
Actions action;

@BeforeTest
public void beforeTest_Admin() throws IOException, AWTException
{
    
    htmlReporter = new ExtentHtmlReporter("./reports/extent.html");
    htmlReporter.config().setEncoding("utf-8");
    htmlReporter.config().setDocumentTitle("Automation Report");
    htmlReporter.config().setReportName("Automation Test Results");
    htmlReporter.config().setTheme(Theme.STANDARD);
    
    extent = new ExtentReports();
    extent.attachReporter(htmlReporter);
    
    extent.setSystemInfo("Automation Tester","XXXXX");
    extent.setSystemInfo("Organization","XXXXX");
            
    r = new Robot();
    action = new Actions(admin);
    src = new File("C:\Users\DELL\eclipse-workspace\XxxxOnlineDemo\Object_Repo.properties");                    
    objfile = new FileInputStream(src);
    obj = new Properties();
    obj.load(objfile);
    
    Map prefs = new HashMap();
    prefs.put("profile.default_content_setting_values.notifications", 1);
    ChromeOptions options = new ChromeOptions();
    options.addArguments("--use-fake-ui-for-media-stream");
    options.setExperimentalOption("prefs", prefs);
    System.setProperty("webdriver.chrome.driver", "E:\drivers\chromedriver.exe");
    admin = new ChromeDriver(options);
    admin.manage().window().maximize();

}

@BeforeTest
public void beforeTest_participant()
{
    System.out.println("before test of participant is running");
    
    Map prefs1 = new HashMap();
    prefs1.put("profile.default_content_setting_values.notifications", 1);
    ChromeOptions options1 = new ChromeOptions();
    options1.addArguments("incognito");
    options1.addArguments("--use-fake-ui-for-media-stream");
    options1.setExperimentalOption("prefs", prefs1);
    System.setProperty("webdriver.chrome.driver", "E:\drivers\chromedriver.exe");
    participant = new ChromeDriver(options1);
    participant.manage().window().maximize();
    
}

@AfterMethod
public void tearDown(ITestResult result) {
    
    if(result.getStatus() == ITestResult.FAILURE) {
        
    } else if(result.getStatus() == ITestResult.SKIP) {
        
    } else if(result.getStatus() == ITestResult.SUCCESS) {
        
        String methodName = result.getMethod().getMethodName();
        String logText = "<b>" + "TEST CASE: - "+methodName.toUpperCase()+" PASSED"+ "</b>"; 
        
        Markup m = MarkupHelper.createLabel(logText, ExtentColor.GREEN);
        test.pass(m);
    }
}
@Test(priority=1)
public void CreateRoomFrmBrowser() throws InterruptedException 
{
    test = extent.createTest("Create Room");
    admin.get("https://xxx.xxxxx.com/");
    test.info("Application started");
    admin.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

    System.out.println("Navigated to XXXXxxxonline page");
    WebElement room_Name_field = admin.findElement(By.id(obj.getProperty("txt_room_name_field")));
    room_Name_field.clear();
    room_Name_field.sendKeys("TestDemo");
    admin.findElement(By.id(obj.getProperty("btn_Go"))).click();
    test.pass("Created the room successfully");
    Thread.sleep(3000); 
    String Copy_SharingLink = getElementText(admin, (By.xpath(obj.getProperty("txt_share_link"))));
    System.out.println("Copied link - " + Copy_SharingLink);
    
}

@Test(priority = 2)
public void JoinCallFrmParticipant() throws InterruptedException 
{
    test = extent.createTest("Copy Url");
    
participant.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
url = admin.getCurrentUrl();
System.out.println("Current room url : " + url);
participant.get(url);
Thread.sleep(3000);

}

我在我的代码中创建了 2 个 webdriver 实例,因为我必须从 2 个浏览器(chrome,incognito)加入呼叫。除此之外,我还有一个基本页面,我在其中编写了 类 和一个定位器存储库。以前它工作正常,不知道当我尝试 运行 代码时突然发生了什么,它正在抛出 java.lang.NullPointerException 。请看一下,让我知道哪里做错了,提前致谢

action = new Actions(admin);

//some code

admin = new ChromeDriver(options);
admin.manage().window().maximize();

在将 admin 实例作为 Actions() 的参数传递之前,admin 必须进行初始化。那个地方,就是在扔NPE

admin = new ChromeDriver(options);
admin.manage().window().maximize();

action = new Actions(admin);

//some code