In order to perform operations on a browser using Selenium RC commands, we've to first start the Selenium RC Driver.
'start( )' predefined method of 'Selenium' Class is used to start the Selenium RC Driver.
The Selenium RC Driver drives the browser using the provided Selenium RC Commands after starting it.
Follow the below steps to start the Selenium RC Driver:
1. Create any Java Project say 'RC-Project1' in Eclipse IDE as shown below:
2. Create any Package say 'package1' under the project as shown below:
3. Configure the Project to work with Selenium RC as explained in Post# 3. After configuring the Project should look like this under 'Package Explorer' in Eclipse IDE (i.e. as shown below):
4. Create a new Class say 'Class1' under 'package1' package as shown below:
5. Create a Selenium object 'object1' as shown below:
Note - Resolve the error as explained in previous posts.
6. Create any method say 'setUp( )' inside the 'Class1' class as shown below:
8. Assign the object reference of 'DefaulSelenium' predefined Class to the 'object1' object of Selenium Class and also call the 'DefaultSelenium' Constructor with parameters while assigning itself as shown below:
Note - Resolve the error with DefaulSelenium as explained in previous posts.
9. Start the Selenium RC Driver using 'start( )' predefined method of 'Selenium' Class as shown below:
10. Create another method say 'testMethod( )' and specify it as @Test as shown below:
Note - Resolve the Error with @Test annotation as explained in previous posts.
11. Save the Class as shown below:
11. Configure the Selenium Standalone Serve as explained in Post#4
12. Start the Selenium Standalone Server as explained in Post# 5
13. Run the 'Class1' class using JUnit as shown below:
14. Ensure that the following two browser windows are displayed as shown below:
So to conclude, start( ) predefined method of 'Selenium' Class will open the two browser windows (Refer screenshot under Step 14) . Top window is the driver window, it drives the Selenium commands and displays the executed Selenium Commands under the 'Command History'. Bottom window will be driven by the Selenium Commands if there are any. Suppose if our code has a selenium command to open any URL say "www.selenium143.blogspot.com" then the bottom browser will open the specified URL.
Watch the below video to understand how the 'start( )' method works:
Click here to watch the video
Download this Project:
Click here to download the project explained in this post and import into Eclipse IDE on your machine.
Please comment below to feedback or ask questions.
'open( ) - predefined method to open the specified URL will be explained in the next post.
No comments:
Post a Comment