36. Using open( ) method to navigate to the Home page





We can navigate to the Home page of the URL using the open( ) method.

For example if our Selenium Automation Code has the following two lines as shown below:

object1.open("http://book.theautomatedtester.co.uk/chapter1");    // Chapter 1 page
object1.open("/");      // This will navigate the User from Chapter1 to Home Page i.e. http://book.theautomatedtester.co.uk

Lets Implement This:

Pre-requisites:

1. Create a new Project say 'RC-Project8' in Eclipse IDE
2. Configure the Project to work with Selenium RC
3. Configure the Selenium Standalone Server to run from Eclipse IDE
4. Start the Selenium Standalone Server
5. Create a package say 'package_eight' under the newly created project.
6. Create a Java Class file say 'Class8' under the newly created package as shown below: 




Actual Steps:

1. Write the following code into the newly created Java Class file as shown below and make sure that you resolve all the errors before going to next step:




2. Start the Selenium Standalone Server
3. Save and Run the 'Class8.java' file by selecting the 'JUnit Test' option and ensure that User is navigated from the 'chapter1' page to Home page as shown below:




Watch the below video:

Click here to watch the video.

Download this Project:


Click here to download this project and import into Eclipse IDE  on your machine.

Please comment below to feedback or ask questions.

Using open( ) method to navigate to specific pages of Base URL will be explained in the next post.



No comments:

Post a Comment

Followers

Labels