isSomethingSelected Selenium RC command verifies whether any option is selected in the drop down field.
- Returns Boolean value true when any list option is selected in the drop down field
- Returns Boolean value false when no list option is selected in the drop down field
Example:
selenium.isSomethingSelected("css path for locating drop down field"); -> This statement returns either true or false.
Test Description:
Now lets use isSomethingSelected( ) method to find out whether any list option is selected in the drop down field
Now lets use isSomethingSelected( ) method to find out whether any list option is selected in the drop down field
- If the result is true, then type the text 'list option is selected in the dropdown field' into the TextArea field
- If the result is false, the type the text ' No list option is selected in the dropdown field' into the TextArea field
Understand the comments mentioned on the above screenshot to make yourself clear:
Lets Implement the Test on Eclipse IDE:
Pre-requisites:
1. Create a new Project say 'RC-Project50' in Eclipse IDE
2. Configure the Project to work with Selenium RC
3. Configure the Selenium Standalone Server to run from Eclipse IDE
4. Create a package say 'package50' under the newly created project.
5. Create a Java Class file say 'Class50' under the newly created package as shown below:
Pre-requisites:
1. Create a new Project say 'RC-Project50' in Eclipse IDE
2. Configure the Project to work with Selenium RC
3. Configure the Selenium Standalone Server to run from Eclipse IDE
4. Create a package say 'package50' under the newly created project.
5. Create a Java Class file say 'Class50' 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:
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. Create a test method 'isSomethingSelectedDemo()' and use Selenium RC command isSomethingSelected as shown below
3. Use Selenium RC command type for
- entering the text 'list option is selected in the drop down field' into the Text Area field when the result of the Selenium RC command isSomethingSelected is true.
- entering the text 'No list option is selected in the drop down field' into the Text Area field when the result of the Selenium RC command isSomethingSelected is false.
As shown below:
4. Start the Selenium Standalone Server
5. Save and Run the 'Class50.java' file by selecting the 'JUnit Test' option and ensure that our Automation Test has entered the text 'list option is selected in the drop down field' as shown in the below video:
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 isSomethingSelected command with multi-select field will be explained in the next post.
5. Save and Run the 'Class50.java' file by selecting the 'JUnit Test' option and ensure that our Automation Test has entered the text 'list option is selected in the drop down field' as shown in the below video:
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 isSomethingSelected command with multi-select field will be explained in the next post.
No comments:
Post a Comment