RE: How to validate?



I was trying to select few products and adding them to cart/Bag and I want to verify the selected Products are same in the cart/Bag. Please let me know how to do it.

URL is:

Note: What all items you are selecting those items should be in your shopping cart.

Rocky Doctor Asked on September 6, 2014 in Selenium WebDriver.
Add Comment
5 Answers

hi Rocky
I Would Suggest You to Write a Method With Webelement in  Parameter
And inside Method Find Element  in Try Block and in case Method Runs Successfully Element is Present Else Catch Null Pointer Exception
and Write a Message Element not Present
i Hope it Will Work


Vice Professor Answered on September 8, 2014.

Hi Ankit,

Thanks for your time and suggestion on the above query. I tried with different logic but didn’t get success. The same data in two different pages and code should be generic (Because dealing with ecommerce application).

For simple ex:
1.Open the
2.Select 2 products
3.Go to the Shopping bag/Cart
4.Verify whether selected products in 2 steps are exists in Shopping bag/Cart (Step 3).

But  above using different methods (Step 2 and 3 should be in different methods) and code should be generic.

Just I am trying to compare text of selected items.

on September 8, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.