Post

1 Star2 Stars3 Stars4 Stars5 Stars
Loading ... Loading ...

By Arun Motoori

Selenium RC command isElementPresent works similar to the isTextPresent command. But isElementPresent can be used to verify whether any element on the page like heading text, drop down field, text fields, radio buttons, check box options etcTest Description:First of all lets understand the Test Description by going through the comments mentioned on the below screenshot.
Syntax:isElementPresent(“CSS path for locating the element”);Lets Implement This:Pre-requisites:1. Create a new Project say ‘RC-Project59’ in Eclipse IDE2. Configure the Project to work with Selenium RC3. Configure the Selenium Standalone Server to run from Eclipse IDE4. Create a package say ‘package59’ under the newly created project.5. Create a Java Class file say ‘Class59’ 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. Write the test method ‘isElementPresentDemo()’ as shown below:
3. Use Selenium RC command isElementPresent( ) for verifying whether the drop box field element is present on the page of the website and use Selenium RC command select to select ‘doc 4’ list option if the drop box field element is present on the page as shown below:
4. Start the Selenium Standalone Server5. Save and Run the ‘Class59.java’ file by selecting the ‘JUnit Test’ option and ensure that our Automation Test has selected the ‘doc 4’ list option from the drop down field to confirm that the the drop down field element specified in the Selenium RC command isElementPresent is present on the web page 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 getXPathCount command will be explained in the next post.

Source: http://seleniumone-by-arun.blogspot.com/2013/05/143-using-iselementpresent-command.html

Category: aafm. 143. Using isElementPresent command

Você também pode querer ler

Comments are off for this post.