Google+

17. Validate elements using verify mechanism






As we've learnt in the previous post that verify mechanism will check whether the element is on the post, if it is not  available, the test will fail the step and continue executing the remaining steps. 

The following steps will show how verify mechanism validates elements:

Example: Check whether the Google Logo is available on the www.Google.com page. (i.e. The test will passes if the Google Logo exists on the Google page else it fails).

1. Launch Selenium IDE from Firefox Browser -> Tools Menu
2. Ensure that the Selenium IDE is launched and also ensure that 'Record' option is enabled by default.
3. Type www.google.com in the Firfox Address bar and press 'Enter' button on the keyboard
4. Ensure that the Google page is displayed in the Firefox Browser
5. In Google Page, right click on the UI element to be validated i.e Google Logo in this example as shown below:



6. In the right click menu options, select 'Show All Available commands' option as shown below:



7. Ensure that the sub-menu options for the 'Show All Available commands' option is displayed and select 'VerifyElementPresent' option as shown below:





8. In Selenium IDE -> Table tab, ensure that verifyElementPresent element is added as shown below:



9. Click on the 'Record' button to turn off the recording process as shown below:


10. Playback or Run the above recorded validation, by click on the 'Play current test case' option on the Selenium IDE as shown below:



11. After the test Run, ensure that the 'verifyElementPresent' command under the Selenium IDE -> Table tab is displayed in Green color (i.e.Green means the step got passed and the UI element is  present i.e. Google Logo in this example is present on the Google Page)  as shown below:




12. If the element is not present (i.e. Google Logo in this example), then the step will  fail and displayed in red color as shown below: 



13. If in case the test fails as shown in the step 12, all the steps to be executed after the failed step will also get executed

Note: - Verify commands in the right click menu and sub-menu options wont be shown if Selenium IDE is not installed on the Firefox browser






Please comment below to feedback or ask questions.

How to view the source code of the steps recorded using Selenium IDE in our desired language will be explained in the next post.








6 comments:

ThisTimeToday said...

Your Blog for Learning Selenium absolutely brilliant. I love to more and more posts to help guys like me :)

Arun Motoori said...

@ThisTimeToday - Sure. Will continue writing more and more posts. :)

raghavi said...

Hi Arun i was so much afraid to learn selenium as it is based on java but while goggling i found Ur blog and it given me a hope thank u so much for this blog its really very useful for all the automation beginners

Arun Motoori said...

@ Raghavi :)

shankey jain said...

Hi Arun,

You are doing a great job for helping people..as this is the best blog for learning selenium i have gone through.

I have a concern that a lot of images aren't loading on various pages.

It would be great if you could resolve this problem.

Thanks!!

Shankey Jain

sonu said...

Sir can you tell me what should be the research component when we develop an automated testing framework. i mean how the next generation framework will be advanced from existing one. plz tell in research point of view

Blog Index