Tuesday, September 10, 2013

SELENIUM RC

What is Selenium RC?

Selenium RC (Remote Control) is an automation test tool that allows to create automation scripts for web based testing in any programming language such as JAVA, C#, PHP, Ruby, Python etc.
Selenium RC injects javascript to execute the test and is really ease to work with all browsers and platforms and also good supported for ajax applications as well.

Selenium RC have two parts:

  • Selenium server - Launches the browser and execute the test cases.
  • Selenium remote control - Provides an application programming interface with lots of libraries to support different programming languages

Architecture:

With different programming language and object oriented support gives you the ability to create more complex test cases that are not possible through Selenium IDE. You can executes these test cases as many time as required by using frameworks available in Java i.e. TestNG or JUnit. Also helpful while handling expected exceptions.

How to configure Selenium RC?

Pre Requisite:

Start Selenium RC standalone server:
Open command prompt and go to the directory where the Selenium RC jar file was kept and then write:

java -jar selenium-server-standalone-2.20.0 


Create a new class file and copy paste the recorded script code. Now run it as a Java application.

Basic Selenium RC methods:
  • selenium.start() - Takes you to the location where selenium server is and runs the server.
  • selenium.open() - Takes you to the provied URL/Website address.
  • selenium.getTitle() - Get the title of the current browser window.
  • selenium.windowFocus() - Get the focus on the current window.
  • selenium.windowMaximize() - Maximizes the current window.
  • selenium.close() - Close the current browser window.



Method Detail:

start

public void start()
Description copied from interface:
Launches the browser with a new Selenium session

stop

public void stop()
Description copied from interface:
Ends the test session, killing the browser

click

public void click(java.lang.String locator)
Description copied from interface:
Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call waitForPageToLoad.

doubleClick

public void doubleClick(java.lang.String locator)
Description copied from interface:
Double clicks on a link, button, checkbox or radio button. If the double click action causes a new page to load (like a link usually does), call waitForPageToLoad.

clickAt

public void clickAt(java.lang.String locator,
                    java.lang.String coordString)
Description copied from interface:
Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call waitForPageToLoad.


doubleClickAt

public void doubleClickAt(java.lang.String locator,
                          java.lang.String coordString)
Description copied from interface:
Doubleclicks on a link, button, checkbox or radio button. If the action causes a new page to load (like a link usually does), call waitForPageToLoad.


fireEvent

public void fireEvent(java.lang.String locator,
                      java.lang.String eventName)
Description copied from interface:
Explicitly simulate an event, to trigger the corresponding "onevent" handler.

keyPress

public void keyPress(java.lang.String locator,
                     java.lang.String keySequence)
Description copied from interface: 
Simulates a user pressing and releasing a key.


shiftKeyDown

public void shiftKeyDown()
Description copied from interface:
Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.


shiftKeyUp

public void shiftKeyUp()
Description copied from interface: Release the shift key.

metaKeyDown

public void metaKeyDown()
Description copied from interface: Selenium
Press the meta key and hold it down until doMetaUp() is called or a new page is loaded.





Friday, September 6, 2013

Selenium Q & A

Q :which component is NOT part of Selenium suite.

A: Selenium Web 

Q :which language is NOT supported by the Selenium RC.

A: ASP

Q : which name is NOT the type of the locaters.

A: Password

Q : Is Web Driver a component of the Selenium?

A: Yes 

Q : Selenium IDE stands for

A: Selenium Integrated Development Environment
Q : Select the Browser which is supported by Selenium IDE
A: Mozilla Firefox 
Q : which operating system is NOT supported by Selenium IDE.
A: Unix
Q : The Web driver is used.

A : To execute tests on the HtmlUnit browser.  
Q : The Selenium IDE is used

A : To test a web application against Firefox only.
Q : The Selenium RC is used

A : To run your test against different browsers (except HtmlUnit) on different operating systems. 
Q : which command is NOT a type of assertion in Selenium IDE.
A: Wait command.

Q : which method selects the option at the given index.

A :selectByIndex() 
Q :Can Google chrome be supported by Selenium IDE?

A: No.

Q : Can Unix operating system be supported by Selenium IDE?

A :
No 
Q : Which command can be used to enter values onto text boxes?
A : sendKeys() 
Q :which language is supported by The Selenium Web Driver.
A : Perl
Q : Which Selenium component supports All Operating System?
A : Selenium WebDriver 
Q : Which command in Selenium IDE used to open a page using the URL.
A : Open 
Q : In case of Selenium IDE, the Source view shows your script in

A :
HTML format. 
Q : which command is used to print a string value or a variable in Selenium IDE.

A: The 'echo' command.

Q : Which component of Selenium can create customized test results.

A : Web driver 
Q : which command is used to compare the contents of a table with expected values.
A : verifyTable