1

I m facing the below issue searched in Google couldn't find the clear answer how to resolve this.

Error :

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

Code

import org.openqa.selenium.chrome.ChromeDriver;

public class Newtours 
{ 
     public static ChromeDriver driver; 
     public void chrome() 
    {
         System.setProperty("webdriver.chrome.driver","C:\\Users\\imper\\Downloads\\chro‌​medriver_win32\\chro‌​medriver.exe"); // objects and variables instantiation 
         driver = new ChromeDriver(); 
         driver.get("newtours.demoaut.com/");
    }
}
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Fouziya Hanif
  • 21
  • 1
  • 6
  • Your code trials and relevant HTML please. – undetected Selenium Dec 29 '17 at 05:53
  • Not having any HTML relevant. Try to run the application in eclipse import org.openqa.selenium.chrome.ChromeDriver; public class Newtours { public static ChromeDriver driver; public void chrome() { System.setProperty( "webdriver.chrome.driver","C:\\Users\\imper\\Downloads\\chromedriver_win32\\chromedriver.exe"); // objects and variables instantiation driver = new ChromeDriver(); driver.get("http://newtours.demoaut.com/"); }} faced the mentioned issue – Fouziya Hanif Dec 29 '17 at 06:05
  • Edit the Question and update this code block and the error you see for proper analysis. – undetected Selenium Dec 29 '17 at 06:08
  • check out this link [https://stackoverflow.com/questions/9609066/getting-following-exception-org-apache-bcel-verifier-exc-assertionviolatedexcept](https://stackoverflow.com/questions/9609066/getting-following-exception-org-apache-bcel-verifier-exc-assertionviolatedexcept) – Kuldeep Yadav Dec 29 '17 at 07:48

2 Answers2

0
System.setProperty("webdriver.chrome.driver", "chromedriver");
driver = new ChromeDriver(); 
driver.get("http://newtours.demoaut.com/");

Try this code it's working fine. I checked this and it's running fine. You need to give http or https for your url.

Hiten
  • 724
  • 1
  • 8
  • 23
0

The error is stemming out of org.apache.bcel.verifier

You have to take care of a certain things as follows :

Instead of using the ChromeDriver implementation use the WebDriver interface. chrome is a reserved keyword. Use some other user defined name for the method e.g. my_function() {} Simply defining public void chrome() won't execute your Test. You have to convert public void chrome() in to either of the following :

  • Convert into main() function as follows:

        public class Newtours  
        {
            public static void main(String[] args) 
            {
                System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
                WebDriver driver =  new ChromeDriver();
                driver.get("http://newtours.demoaut.com/");
            }
        }
    
  • Integrate TestNG and add @Test annotations as follows :

        import org.openqa.selenium.WebDriver;
        import org.openqa.selenium.chrome.ChromeDriver;
        import org.testng.annotations.Test;
    
        public class Newtours 
        {
            @Test
            public void my_function()
            {
                System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
                WebDriver driver = new ChromeDriver();
                driver.get("http://newtours.demoaut.com/");
            }
        }
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • tried as said 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) --- facing this issue – Fouziya Hanif Dec 29 '17 at 08:23