Translate

Selenium RC

1) What do you know about selenium RC (Remote Control)?
A)  Selenium RC starts up browsers(one at a time) and then runs commands we pass along from our tests..  It allows us to use a programming language for maximum flexibility and extensibility in developing test logic.. It provides an API and library for each of its supports languages like Java, Ruby, Python, Perl and C#..
-->Selenium RC has 2 components.. Selenium server and Client libraries.. Selenium Server launches and kills browser.. Client libraries provide the interface between each programming language and the Selenium RC server..
2) Briefly explain how Selenium RC executes your scripts ?
A)  Client libraries communicate with the Server passing each selenium command for execution.. Then the server passes the selenium command to the browser using Selenium-Core Java Script commands.. The browser, using its JavaScript interpreter, executes the selenium commands.. This runs the Selenese actions or verifications you specified in your test script..
3) What are the requirements needed to run simple script in RC ?
A)  A browser, command prompt, Selenium Server jar file are enough to run simple scripts in RC..
Selenium Server is needed inorder to run selenium RC scripts..
4) How to set up selenium RC completely with eclipse to run junit tests ?
A)    First we need to download Selenium Server jar file, Selenium client libraries, junit jar file, eclipse and java software.. There after, open eclipse and click on workbench and then create a java project with meaningful name... Set path to java and jar files... Drag and drop your test scripts(which are exported from IDE) to the package you have created in the project.. Before running any test you must start the server..
5) Why selenium RC is used ?
A)   Selenium RC is used to automate web applications with more effective browser actions when compared to SIDE(Selenium IDE).. As selenium RC uses a programming language, we can overcome limitations of SIDE i.e we can handle multiple windows and pop-ups, we can use loops and conditions, capturing screenshot etc.. In addition to that, RC can perform Data-Driven(read/write data from external files) concept, decent report generation and mailing that report to concern person etc.. 
6) What are the languages and operating systems that support RC ?
A)   RC supports languages like Java, C#, Perl, Ruby, Python and PHP.. Operating systems like Windows, Mac OS X, Linux, Solaris etc..
7) What are the advantages and disadvantages of RC ?
A)  advantages:
  • Selenium RC can be used for any java script enabled browser..
  • Support for many operating systems and Programming languages..
  • We can use loops and conditions for better performance and flexibility..
  • Decent report generation..
  • Can handle Dynamic objects and Ajax based UI elements..
  • Can read/write data from/to .txt, .xls, etc..
disadvantages:
  •  There are very limited features in RC when working with Ajax based UI elements..
  • Cannot handle on-load alerts..
  • Controlling multiple windows is somewhat difficult..
8) In Selenium what are the four parameters you have to pass?
A)    Host, port number, browser and URL...
9) Can we handle pop-ups in RC ?
A)    Yes, we can handle pop-ups in RC... Using selectWindow method, pop-up window will be selected and windowFocus method will let the control from current window to pop-up window and perform some actions according to our script..

10) Which method will you use for mouse left click and right click ?
A)    For mouse left click i use 'click' method and for right click i use 'keyDown' method followed by 'click' and 'keyUp' methods i.e 'keyDown' method will press 'control' key without releasing it yet and then click method will be executed, after that 'keyUp' method will release the 'control' key..... Code will be as follows..
          left click      --->  selenium.click(locator)
          right click  --->  selenium.keyDown(locator,keysequence)
selenium.click(locator)
selenium.keyUp(locator,keysequence)
NOTE : Here, all the three locators belong to same element/object and keysequence will be ASCII value for 'control' key...
11) What is the use of 'chooseOkOnNextConfirmation()' ?
A)    This command is used to select/click 'OK' button in the confirmation box and it must be placed before the occurrence of confirmation box...  
12) What is a framework and what are the frameworks available in RC ?
A)    Framework is nothing but a structure that allows us to do things better and faster... It is a collection of libraries and classes and they are very helpful if testers want to automate test cases.. JUnit, NUnit, TestNG, Bromine, RSpec, unittest are some of the frameworks available in RC ..
13) How do you handle secured connection error in HTTPS ?
A)    Create an object to 'RemoteControlConfiguration' class, set 'TrustAllCertificate' flag to true and then pass remotecontrolcofiguration instance to SeleniumServer. i.e.
RemoteControlConfiguration r= new RemoteControlConfiguration();
r.setTrustAllCertificate(true);
SeleniumServer s=new SeleniumServer(r);
14) If the default port of selenium is busy then which port you will use ?
A)    We can use any port number which is valid.. First create an object to remote control configuration. Use 'setPort' method and provide valid port number(4545,5555,5655, etc).. There after attach this remote control configuration object to selenium server..i.e
RemoteControlConfiguration r= new RemoteControlConfiguration();
r.setPort(4567);
SeleniumServer s= new SeleniumServer(r);
15) How do you select second value from a drop down menu ?
A)   Define an array of string type.. By using 'getSelectOptions' command provide locator for that particular drop down and then use 'select' command.. As 'select' command parameters are locator and the label, in-place of label, define array index... i.e,.
String a[]=selenium.getSelectOptions(locator of drop down);
selenium.select("locator of drop down", a[1]);
note: If you want to select 5th value from drop down, then provide '4' in the index of an array because array index starts from 'zero'...
16) What is the difference between sleep() and setSpeed() methods ?
A)    Both will delay the speed of execution... When you use Thread.sleep(), then the execution of your test will be stopped until the time you have provided in sleep method, it will wait only once where the command is used where as using setSpeed() method we can set the time of delay which will follow each and every selenium command i.e if you set 5000 milliseconds then your test execution will wait 5 seconds after each and every selenium operation

16 comments:

shri said...

good one

Alok tiwari said...

very helpful

Alok tiwari said...

very helpful

Alok tiwari said...

very helpful

Anonymous said...

Thank you so much....

Anonymous said...

Really Helpful and Thanks Madam/...

Anonymous said...

Very Nice and helpful.
Also because one does not need to become a member of the site.

Thanks..

Jagadishwar Reddy said...

Thanks so much it was very much useful can u pls explain something abt keyword driven framework in selenium using a simple example

Anonymous said...

Thank you....very useful

Anonymous said...

thanks so lot Sirji,
when will you update Selenium webdriver IQ

Upasanasrecipes said...

Very nice n helpful post.Please add Selenium Web driver interview questions n answers also.

KODALI ASHOK CHOWDARY said...

Thank u so much for these one....really its helpfull....

ruchi goyal said...

for more selenium interview questions ans answers.
please visit-http://www.studyselenium.com/2013/12/100-selenium-interview-questions.html

VKN GUPTA KOTHAGUNDLA said...

it'nice one....

Anonymous said...

its really helpful....Nice work

Anonymous said...

its really helpful....Nice work