Saturday, August 23, 2014

Selenium : Selenium WebDriver And Interface

 WebDriver And Interface






Q. What Is An Interface And Why To Use It?

Interface is set of rules for behavior of application. Interface looks like class but it is not. When you implements that Interface In any class then all those Interface rules must be applied on that class.
 In short, if you implement an Interface on class then you must have to override all the methods of Interface In your class. Interface will create Rules to follow structure for class where it Is Implemented. This way, if you look at the code of Interface, You can get Idea about your program business logic. When you are designing big architecture applications like selenium web driver, you can use Interface to define business logic at Initial level.
 Interface can be implemented with any class using implements keyword. There are set of rules to be followed for creating an Interface. Let me tell you all these rules first and then give you an example of an Interface.

1.       Interface can not hold constructor.
2.       Interface can not hold instance fields/variables.
3.       Interface can not hold static methods.
4.       You can not instantiate/create object of an Interface.
5.       Variables Inside Interface must be static and mandatory to initialize the variable.
6.       Any class can Implement Interface but can not extend Interface.
7.       Can write body less methods Inside Interface.
8.       By default all the methods and variables of Interface are public so no need to provide access modifiers.

public interface College {        //Interface file
     static String Collegename = "XYZ";  //static by default
     void StudentDetails();    //Created non static methods without body.
     void StudentResult();
}

public class Computer implements College {
                                        //@Override annotation describes that methods are overridden on interface method.
                                         //Methods name, return type are same as methods of an Interface.
     @Override
     public void StudentDetails() {  System.out.println("hi"); }

     @Override
     public void StudentResult() { System.out.println("bye");  }
}

public class TestCollege
{                  //Class file. No need to implement Interface.

                    public static void main(String[] args)
{
                                         //Can access Interface variable directly using Interface name.
                                        System.out.println(College.Collegename+" Collage student details.");
 
                                                            //Created Computer class object with reference of interface College.
                                        College compdept = new Computer();
                                                            //Methods will be called from Computer class.
                                        compdept.StudentDetails();
                                        compdept.StudentResult();
 }
}
-------------------------------------------------------------------------------------------------------------------------
Selenium WebDriver And Interface

Simple example of Interface In selenium WebDriver Is WebDriver Interface. When you are Initializing any browser using selenium WebDriver, You are writing statements like bellow.

WebDriver driver = new FirefoxDriver();
Or
WebDriver driver = new ChromeDriver();

You can view more examples of selenium WebDriver on THIS PAGE.Here, WebDriver Is Interface and FirefoxDriver and ChromeDriver are the class files where WebDriver Interface Is Implemented.

http://software-testing-tutorials-automation.blogspot.in/2014/04/interface-in-java-tutorials-for.html

38 comments:

  1. Hi , Kathi I cannot comment on any Training institutes as I had seen both good and bad .As far as syllabus is concerned , it depends on what dept they are covering each topic and everything cannot be taught,as somethings requires individual effort . If you get a good trainer to teach all that they have mentioned then the rest can be managed ... I would say use Job description in Job sites for Android openings as benchmark to compare your syllabus ...All the best :-)

    ReplyDelete
  2. I really, really love this design and approach! It is reusable, robust and makes sense when you think about it. Thank you for sharing Selenium Training in Chennai

    ReplyDelete
  3. When we speak of Selenium, we are actually talking about both its flavours: Selenium WebDriver and Selenium IDE. Both automate browsers in support of web application testing. WebDriver is typically used to create browser-based regression tests, whereas Selenium IDE is most advantageous in creating unit tests, exploratory tests and one-off bug reproduction scripts. There is no need to make further distinctions between the two, however, when discussing Selenium’s advantages and disadvantages.
    Selenium Training in Chennai | Selenium Trianing in Velachery

    ReplyDelete
  4. hello,It was really great.wow Bulk of information shared in single blog.Thanks for collecting all that information & update it.You want more Details.... Selenium Training in Chennai
    Hadoop Training in Chennai
    Dot Net Training in Chennai
    Android Training in Chennai

    ReplyDelete
  5. It is a free Open Source test automation framework that works with any tool (Selenium,Python and C# code or test tools like Selenium, Appium, etc.) can be used Learn looked for
    Hadoop Training in Chennai
    Selenium Training in Chennai
    Software Testing Training in Chennai

    ReplyDelete
  6. I simply want to say I’m very new to blogs and actually loved you’re blog site. Almost certainly I’m going to bookmark your blog post . You absolutely come with great well written articles. Thanks a lot for sharing your blog.
    Android Training in chennai |Best Android Training in Velachery | android development course fees in chennai

    ReplyDelete
  7. DIAC - We are Training industries in the field of industrial automation, industrial maintenance and industrial energy conservation. This opportunity for Fresher/Experienced ENGINEERS in terms of CORE Training And Placements. Call 9310096831.

    ReplyDelete
  8. Really cool post, highly informative and professionally written and I am glad to be a visitor of this perfect blog, thank you for this rare info!

    selenium training in bangalore|

    ReplyDelete
  9. I have to voice my passion for your kindness giving support to those people that should have guidance on this important matter.
    hadoop training in bangalore
    hadoop training in chennai

    ReplyDelete
  10. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    dot-net training in chennai

    ReplyDelete
  11. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.

    Python Training in Chennai
    AngularJS Training in Chennai
    Best AngularJS Training in Chennai

    ReplyDelete
  12. Thanks for Sharing this Valuable Information i like this i Can Share this in My Friend Circle.
    Selenium Training in Noida

    ReplyDelete
  13. Australia Best Tutor is one of the best Online Assignment Help providers at an affordable price. Here All Learners or Students are getting best quality assignment help with reference and styles formatting.

    Visit us for more Information

    Australia Best Tutor
    Sydney, NSW, Australia
    Call @ +61-730-407-305
    Live Chat @ https://www.australiabesttutor.com




    Our Services

    Online assignment help
    my assignment help Student
    Assignment help Student
    help with assignment Student
    Students instant assignment help

    ReplyDelete

  14. This concept is a good way to enhance the knowledge.thanks for sharing. please keep it up selenium Online Training

    ReplyDelete
  15. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

    Devops training in Chennai
    Devops training in Bangalore
    Devops training in Pune
    Devops Online training
    Devops training in Pune
    Devops training in Bangalore
    Devops training in tambaram

    ReplyDelete
  16. You blog post is just completely quality and informative. Many new facts and information which I have not heard about before. Keep sharing more blog posts.


    java training in chennai | java training in bangalore

    java online training | java training in pune

    selenium training in chennai

    selenium training in bangalore

    ReplyDelete
  17. I really appreciate this post. I’ve been looking all over for this! Thank goodness I found it on Bing. You’ve made my day! Thx again!

    angularjs Training in chennai

    angularjs Training in bangalore

    angularjs-Training in tambaram

    angularjs-Training in sholinganallur

    ReplyDelete
  18. I was looking for this certain information for a long time. Thank you and good luck.
    python training in velachery
    python training institute in chennai

    ReplyDelete
  19. Do you have a spam issue on this website; I also am a blogger, and I wanted to know your situation; many of us have developed some nice methods
    iosh course in chennai

    ReplyDelete
  20. Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.

    Java training in Tambaram | Java training in Velachery

    Java training in Omr | Oracle training in Chennai

    ReplyDelete
  21. Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
    Data Science Course in Indira nagar | Data Science Course in btm layout

    Python course in Kalyan nagar | Data Science course in Indira nagar

    Data Science Course in Marathahalli | Data Science Course in BTM Layout

    ReplyDelete
  22. It is a great post. Keep sharing such kind of useful information.

    Education
    Technology

    ReplyDelete
  23. I would like to say thank you for the amazing details and concepts you are sharing in this.

    Oracle PLSQL Training in Chennai
    Oracle PLSQL Training

    ReplyDelete