GroTechMinds

Automation testing with Java and Selenium
Automation Testing All Differences from Java and Selenium
This Calling Statement Super Calling Statement
It is use in the case of constructor overloading It is use in the case of inheritance
It should be written explicitly It can be written both ways
It is use to call from one constructor to another constructor within class It is use to call from one one constructor of one class to another constructor of another class
It should be the first line in any constructor It should be the first line in any constructor and we can’t have combination of this and super calling statement in any constructor
This keyword Super Keyword
Whenever global variable and your method parameter are same then we can use this keyword It is use only in the case of method overriding if you need parent class implementation along with child class implementation
This keyword can be written only in the case of non static method Super keyword can be written only in the case of non static method
Abstract Class Interface
   
Abstract class can have abstract and non-abstract methods. Interface can have only abstract methods. Since Java 8, it can have default and static methods also.
Abstract class doesn’t support multiple inheritance. Interface supports multiple inheritance.
Abstract class can have final, non-final, static and non-static variables. Interface has only static and final variables.
Abstract class can provide the implementation of interface. Interface can’t provide the implementation of abstract class.
The abstract keyword is used to declare abstract class. The interface keyword is used to declare interface.
An abstract class can extend another Java class and implement multiple Java interfaces. An interface can extend another Java interface only.
An abstract class can be extended using keyword “extends”. An interface can be implemented using keyword “implements”.
A Java abstract class can have class members like private, protected, etc. Members of a Java interface are public by default
It can have constructors and static methods also.  
Throw keyword Throws keyword
   
Used within a method (or constructor) Used with method (or constructor) signature
Used to throw an exception explicitly Used to declare exceptions
Can only throw a single exception Can declare multiple exceptions
Followed by a throwable instance Followed by an exception class name
Cannot be used to propagate checked exceptions by itself Can be used to propagate checked exceptions by itself
Local Variable Global Variable
   
Definition: It is present within any method It is present outside any methods but within the class.
Scope: WIthin method From the beginning of class and til the end of clas
cannot classify them into static and non static It can be static and non static
it will not have any default value Global Variable will have its own default value
It has to be initialized before utilising them. Can be utilised without even initializing it
Final Keyword Finally Keyword
   
It can be used with variable,Class and methods. It is keyword to be used in exceptional handling concept of Java.
Any variable which is final will not change its value Finally keyword to be used only after try and catch block.
Any method which is final cannot be overridden Since we are not sure if try will execute or catch will execute but we are sure that finally will execute for sure.
Any class which is final can never be inherited.  

 

Arrays Collection
Can store only homogeneous value It can store both homogeneous and heterogeneous value.
Arrays are known for its fixed size-we cannot increase or decrease the size of an array at run time here we can increase or decrease the size of a collection at run time
Arrays is a in built feature of java but we have to develop the logic Collection framework is an API which provides classes,methods and interfaces in it
Syntax:
String name[]=new String[3];
or
String name[]={“RAM”,”Vishnu”,”Sham”};
Syntax:
ArrayList a1=new new ArrayList();
FindElement FindElements
Return type is WebElement Return Type is List<Webelement>
If element is not found it will give NoSuchElementException If element is not found it will give empty list

Conclusion: In conclusion, understanding the differences between Java and Selenium in automation testing is important for improving the efficiency and efficacy of your testing operations. By combining the distinct features and capabilities of Java and Selenium, you can construct powerful and dependable automated tests that verify your product runs correctly.

Share:
Upskill Yourself
Consult Us