7

I'm working through the "Selenium Simplified" book just to really gain a solid understanding of Selenium and Java. I know the basics of Java, but this one is frustrating me. I must be missing some important jar file, but I'm not sure what that is. I'm also wondering if this has to do with version issues. The book goes through and guides you through an older version of Selenium as well as using JUnit3. I did try the code in JUnit3 and I'm still getting the warnings for the deprecated class. Here's a snapshot of my code with the libraries being used.Screenshot from Eclipse

2
  • Which version of Selenium are you using?
    – user246
    Commented Jun 28, 2011 at 15:08
  • Selenium Version 1.0.10
    – Jason M
    Commented Jun 28, 2011 at 15:40

2 Answers 2

9

SeleneseTestCase is deprecated and shouldn't be used any more, use extends SeleneseTestBase instead.

2
  • if SeleneseTestCase is deprecated,that I can use in this place ?, or which is the version of selenium is used now ? I use selenium with junit4 and jdeveloper
    – user4453
    Commented Nov 28, 2012 at 21:43
  • The old Selenium RC API is deprecated now. You should really be using the WebDriver API have a look at code.google.com/p/selenium/downloads/list
    – Ardesco
    Commented Dec 1, 2012 at 13:43
2

It is a warning that could be ignored. The code will execute as expected despite the warnings. Just add @SuppressWarnings above the method to remove these warnings so that the code looks tidy.

Pseudocode:

   @SuppressWarnings({ "deprecation", "unused" })
   public class testWeather extends SeleneseTestCase 
   {
     ....
   }
4
  • Aruna's reply is right. The easy way to do is, just to click on the error fix warning, that eclipse is giving you to the left side of the line of code in the eclipse ide, it will give you a suggestion containing the option to add suppress warning,click on it and that will automatically add the suppress annotation u need to give and fix your issue. Hope this helps Commented Jun 30, 2011 at 5:45
  • 2
    It may stop the warnings from showing up but it doesn't resolve the root cause of the problem which is that you are using deprecatd code and you should stop using it. When Selenium 2 goes final a lot of deprecated methods are being removed (RC3 already removed a lot of deprecated things) so if you are unlucky this will be part of the cull. The sensible thing to do is to stop using SeleneseTestCase.
    – Ardesco
    Commented Jun 30, 2011 at 10:24
  • Yes Ardesco a consistent solution for Jason's issue is to avoid the deprecated code, but until he comes across with a fix for that he can use the annotation. Commented Jun 30, 2011 at 12:06
  • 2
    What do you mean comes across a fix for it? The fix is don't use deprecated code, instead extend the class correctly as explained in my answer and it will all work.
    – Ardesco
    Commented Jul 12, 2011 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.