Java 链接文本上的Click()函数不起作用

Java 链接文本上的Click()函数不起作用,java,testing,selenium,selenium-webdriver,testng,Java,Testing,Selenium,Selenium Webdriver,Testng,当我试图通过TestNG打开一个站点时,会出现一个安全页面,为此我单击了一个链接文本“继续访问此网站(不推荐)”,我已经通过TestNG编码完成了该链接,但它给出了java.lang.NullPointerException错误 这就是我正在尝试的代码 public class Registration { WebDriver driver; WebElement element; WebElement element2; WebDriverWait waite

当我试图通过TestNG打开一个站点时,会出现一个安全页面,为此我单击了一个链接文本“继续访问此网站(不推荐)”,我已经通过TestNG编码完成了该链接,但它给出了java.lang.NullPointerException错误

这就是我正在尝试的代码

 public class Registration {
    WebDriver driver;
    WebElement element;
    WebElement element2;
    WebDriverWait waiter;
     @Test(priority = 1)
    public void register_With_Cash() throws RowsExceededException, BiffException, WriteException, IOException 
      {
        File file = new File("D:\\IEDriverServer.exe");
        System.setProperty("webdriver.ie.driver", file.getAbsolutePath());

        driver=new InternetExplorerDriver();
        driver.get("https://172.25.155.250/loginpage.aspx");        
        sleep(10000);

        waiter.until(ExpectedConditions.presenceOfElementLocated(By.linkText("Continue to this website (not recommended).")));
        driver.findElement(By.linkText("Continue to this website (not recommended).")).click();
        sleep(50000);

您可以使用下面的javascript单击
继续访问网站(不推荐)
链接

driver.Navigate().GoToUrl("javascript:document.getElementById('overridelink').click()");

哪一行给了你例外?这一行…………服务员。直到(ExpectedConditions.presenceOfElementLocated(By.linkText(“继续访问此网站(不推荐)”)));请在源代码中粘贴您的异常和它发生的确切行。那么,您在哪里设置了
waterer
?您确实将其设置为某个值,对吗?com.tcs.medmantra.Registration.register_With_Cash(registation.java:54)…上的java.lang.NullPointerException意味着在water.until中(ExpectedConditions.presenceOfElementLocated)(By.linkText(“继续访问此网站(不推荐)”);但它给出了警告“类型WebDriver.Navigation的方法gotour(String)未定义”,我已修改为“driver.navigate().to”(“javascript:document.getElementById('overridelink')。click()”);“……现在它正在工作……非常有用。”