Tuesday 19 March 2013

Maximizing Browser Window using Selenium Rc and Web Driver

Purpose: Maximizing Browser window using Selenium RC and Web Driver

When ever we are opening Web Browser using Selenium RC and Web Driver, it will open in Resized state. But that will not give complete view of the Browser conten. In order to maximize the the window we need to use two different methods in RC and Web Driver.

Maximizing the Browser Window using RC

Once you started the Browser use the following Selenium RC command to maximize the Browser Window
(browser is the object of my DefaultSelenium Class)

browser.windowMaximize();

Maximizing the Browser Window using Web Driver:

It is not as same as RC in Web Driver. We need to use the following command

( driver is the Object of Respective Browser Driver Class )

driver.manage().window().maximize();
 

Unsupported Major/Minor Version issue while executing Selenium Scripts / Java Programs using Eclipse IDE

Purpose: When ever we are executing Selenium Scripts / Java Program which is developed / written in some othere version than our version we will get the error "Java.lang.UnsupportedClassVersionError: .............................Unsupported major.minor version"

If you are executing the program using Console / Command Prompt, using additional parameter -source <version number>

For example, if your file name is VersionError.java and executing through Command Prompt use the following command to execute successfully:

javac -source 1.4 VersionError.java

The program will compile successfully.

If you are executing the code using Eclipse IDE follow the steps mentioned below:

Step 1: Click on 'Project' menu option and select 'Properties' submenu.



Step 2: Click on Project Facts from RNP and Select Java in RNP




Step 3: Select required version of Java and click on OK.

Now Run the application and the issue will be resolved.