Selenium Questions 1


Selenium Mostly Asked Interview Questions 

Q1. How to configure RC in eclipse

Download jar files from internet and include in eclipse projects.
Added inside project under eclipse.

Q2. What is Java Doc?

Documentation of selenium is known as java doc, it is downloaded with Jar files.
Go to javadoc folder and click on index.html.

Q3 what is default selenium class?

It has all the functions which are present in selenium interface its webdriver.

Q4. What is difference between throw and throws exception.

Throw:- we deliberately throws the exception
Throws :- we give the exception when same exception used many times

Q5. Finally block means?

Block which will always run

Q6. What is final keyword?

Final is a variable whose value cannot be changed.

Q7. How to store the entire link on a page using arrays? It may be dynamic.

There is a collection API which in build class called array list, it help in storing dynamic increasing data structure.
Syntax :- arraylist<datatype> <object name> = new arraylist<data type>()
In selenium we can use when we have object in bulk.
 Array list class do not have any final size.

Q8. Hash Table? 

It is also dynamically growing data structure, it’s an inbuilt class
Hashtable <string,string> table = new hashtable <string,string> ()
It always has a key value pair
Eg:-
Table.put(“Key”,”Value)
There is no index there is a key and it should be unique.
One key can have only one value:-
Table.put(“name”,”Aj”)
Now
System.out.println(table.get(“Name”));
It will print Aj, hash table do not have index it will have key value.
In selenium it is used to store test data.
* So collection API has array and hash table.

Q9. How to create a array list inside a array list and hash table inside a hash table?

Hastable<string,string> table1 = new hashtable <string,string>
Table1.put(“City1”,”ja”)
Table1.put(“City2”,”fa”)
Table1.put(“City3”,”ma”)
Hastable<string,string> table2 = new hashtable <string,string>
Table2.put(“City1”,”3021”)
Table2.put(“City2”,”3221”)
Table2.put(“City3”,”3023”)
Make them part of one table
Hastable <string,hashtable<string,string> > table = new hashtable <string,hashtable<string,string> >
Table.put(“name”,table1)
Table.put(“zip”,table2)
System.out.println(table.get(“name”).get(“city2”));
It will put:- fa

Q10. What is reflection API?

It is used to create hybrid frame work; it helps in calling the function whose name is same as the name of variable
String x = “Simplt text”;
Now it will be done by:-
Method method = ReflectionAPI.class.getmethod(x, String.class);
Method.invoke(method, “hellow”);
Method is a inbuilt class in reflection API
And we have a function
Public static void samplttest (string x) {
System.out.println (“In sample test—“ +x);
Now above Reflection API.class.getmethod(x, String.class);
 x will have value = “sample text” and get method will call the method getmethod sametext and String.class means method accept the value sting.
Method.invoke(method, “hallow”); here same text will be called and hallow is printed.
So we can change the value of X and can call any function in it.

10 comments:

  1. Replies
    1. thanks.. If you have any query please post we all can find the solution.

      Regards,
      testwithus

      Delete
  2. Unbilivable work... I was looking such stuff from long time.. Thnks a lot..

    ReplyDelete
    Replies
    1. thanks.. If you have any query please post we all can find the solution.

      Regards,
      testwithus

      Delete
  3. Very good Article on Selenium Web Driver Basics. Found few interesting commands which can be used to add spice to automation work.
    BTW could you please add some more information on parametrization in Web driver using Excel??

    ReplyDelete
    Replies
    1. You can use POI Api for it, it is explained in one of the page.

      Delete
  4. Very Very Thanks to all who have done this great job....
    We really want this stuff

    Thanks Once again...

    ReplyDelete
  5. Thanks...... good stuff.......

    ReplyDelete
  6. nice work..looking forward to see more of web driver stuff..keep posting advanced concepts such that those beginner's can also understand with ease

    thanks again

    ReplyDelete