0

I am trying to write an automated test and the code successfully compiles but when i try executing it as "Java Application", I am getting an AssertionViolatedException error and the code won't execute.

I have already tried:

  1. Changing the sendKeys("string") to sendKeys(new String[] {"string"}).

  2. Executing the application with: "Run as: JAVA APPLICATION"

  3. Setting the jre environment in build path.

The error message I am getting is:

Exception in thread "main" org.apache.bcel.verifier.exc.AssertionViolatedException: 
FOUND:
    INTERNAL ERROR: Oops!
Exiting!!

at org.apache.bcel.verifier.exc.AssertionViolatedException.main(AssertionViolatedException.java:102)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
PratikshaB
  • 37
  • 6
  • You might as well add the code to your question, so from the looks of it it might not be necessarily related to that code. – second Aug 06 '19 at 09:43

1 Answers1

0

This error message...

Exception in thread "main" org.apache.bcel.verifier.exc.AssertionViolatedException: 
FOUND:
    INTERNAL ERROR: Oops!
Exiting!!

at org.apache.bcel.verifier.exc.AssertionViolatedException.main(AssertionViolatedException.java:102)

...implies that there was a RuntimeException which should never be thrown and as per the documentation such exception is thrown due to an INTERNAL ERROR of BCEL's class file verifier JustIce.

This exception and error is defined as:

public static void main(String[] args){
    AssertionViolatedException ave = new AssertionViolatedException("Oops!");
    ave.extendMessage("\nFOUND:\n\t","\nExiting!!\n");
    throw ave;
}

Your code trials would have helped us to debug the issue in a better way. However this exception is thrown when BCEl tries to verify bytecode modifications and fails. Presumably you are using some jar(s)/tool(s) that uses BCEL to modify the bytecode your Java compiler generates. if you are using BCEL as a requirement you need to debug, why it breaks. If you are not using BCEL as a requirement you can try a either of the steps mentioned below:

  • Clean your Project Workspace through your IDE (Project > Clean... > Clean all projects > OK) and Rebuild your project with required dependencies only.

  • Add WebDriverWait bofore invoking sendKeys() method as follows:

    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("button.nsg-button")))sendKeys("string");
    
  • Create a fresh New Project, Rebuild your project with required dependencies only and execute your Tests.
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352