0

I am doing a basic selenium test with Java using Eclipse. I am following this tutorial.

https://www.youtube.com/watch?v=2SzdhH8xAX4

But I get the error when trying to run the code.

enter image description here

And here is this too.

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)

Anyone care to help me solve this problem and execute this simple test?

edinvnode
  • 3,497
  • 7
  • 30
  • 53
  • 1
    Possible duplicate of [The method sendKeys(CharSequence\[\]) in the type WebElement is not applicable for the arguments (String)](http://stackoverflow.com/questions/23485363/the-method-sendkeyscharsequence-in-the-type-webelement-is-not-applicable-for) Basic solutions was "It has a simple solution. Change your compiler compliance level from 1.4 to 1.7." – mrfreester Jan 23 '17 at 17:54
  • Same error. I will edit answer. – edinvnode Jan 23 '17 at 18:00
  • Is it the same line that is giving this `AssertionVioloatedException` error? (`SearchBox.sendKeys("Software")`) or is this error happening somewhere else. – mrfreester Jan 23 '17 at 18:06
  • Somewhere you're using the BCEL library for some reason. You might have some tool running that and it's failing. As a workaround you can always try changing to debug mode or something just to see if that can get you around the issue, but the real solution would be figuring out why you're running that library, and how exactly you want to use it. As for your question, I think these two errors are two unrelated issues. – mrfreester Jan 23 '17 at 18:11
  • Well i thought those 2 errors were related. Here is screen shot of the second error http://prntscr.com/dzdaci – edinvnode Jan 23 '17 at 18:29
  • Yeah it looks like your compiler issue for the sendKeys is fixed. This other one is a weird one, and it's hard to guess where you might have the BCEL verifier hooked into your environment/project. Does it only happen when you try to run the code? Or do you get the error even when building the code? If you have any devs around, this might be a good time to have them take a look at what's going on, and they might be aware of how BCEL is used in your organization as well. – mrfreester Jan 23 '17 at 18:43

4 Answers4

2

It's problem with compiler compliance level. Change level by following procedure. Right click on your Java Project->Properties->Java compiler->Change compiler compliance level to 1.7.

Lucky
  • 341
  • 3
  • 8
  • I did just that and resolved the SendKeys problem. But the other problem stayed. The error is in the question. – edinvnode Jan 24 '17 at 18:07
  • 1
    I think you may have imported from wrong package. It would be easy to figure out if you had expand your all imports. – Lucky Jan 31 '17 at 11:26
0

The problem is, that the signature is a var-array, that is CharSequence[] instead of just CharSequence.

Try this:

SearchBox.sendKeys(new String[] { "Software" });

And what is important, please change value name, because all filed must start from lowercase, is a good practice

MatWdo
  • 1,610
  • 1
  • 13
  • 26
0

I have got a same error. SearchBox.sendKeys(new String[] { "Software" }); This is work for me.

0
webelement searchBox =  driver.findElement(By.id("SearchInput")).sendkeys("Software");
S.B
  • 13,077
  • 10
  • 22
  • 49