1

我将 zalenium 用于远程驱动程序,但是当我调用 url 时,浏览器打开,然后引发 java 空指针异常

你试图改变能力

public void GetInvoicing() throws MalformedURLException
{
   System.out.println("launching chrome browser"); 
   DesiredCapabilities capability = DesiredCapabilities.chrome();
   ChromeOptions options = new ChromeOptions();
    //options.addArguments("headless");
    options.merge(capability);
   RemoteWebDriver driver = new RemoteWebDriver (new URL("https://zalenium.payclip.com/wd/hub"),capability);
   driver.get(baseUrl);
}

  @Test(priority=1)
  public void Test1() throws Exception {
  GetInvoicing();


driver.findElement(By.name("username")).sendKeys("santiago.galicia");
driver.close();
    }

我得到的错误是下一个

FAILED: Test1 java.lang.NullPointerException at InvoicingDashboard.TestCases.Test1(TestCases.java:77) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.Invoker.invokeMethod(Invoker.java:580) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:716) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:988) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:505) at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) at org.testng.SuiteRunner.run(SuiteRunner.java:364) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

================================================= 默认测试

测试运行:1,失败:1,跳过:0

4

0 回答 0