如何解决语法错误:语法错误,插入" VariableDeclaratorId"完成FormalParameter

时间:2017-09-18 05:34:21

标签: java selenium-webdriver exception-handling

我使用了以下代码并处理了异常:

 Boolean bIsElementPresent = IsElementPresent(By.xpath("//input[@value='OK']"));
         if (bIsElementPresent)
         {                
                                driver.findElement(By.xpath("//input[@value='OK']")).click();
                 Thread.sleep(2000);
                 driver.findElement(By.xpath("//span[(@class='rtsTxt') and (text()='olicy / Status')]")).click();
                 // Again click on Policy / Status
                 Thread.sleep(2000);
         }

异常处理:

private Boolean IsElementPresent(By by) {
        // TODO Auto-generated method stub
        try
        {
            driver.findElement(by);
            return true;
        }
        catch (NoSuchElementException)
        {
            return false;
        }
    }

但是对于catch(NoSuchElementException) 我收到语法错误:

**Syntax error, insert "VariableDeclaratorId" to complete FormalParameter**

如何删除此错误??? 什么是VariableDeclaratorId来完成FormalParameter ??

请帮助

0 个答案:

没有答案