RE: How to validate?

Answered

Hi,

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: http://store.demoqa.com/products-page/product-category/

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
Best answer

HI Rocky,

First of all thanks for aksing using ForumsQA, second many thanks for supporting us by giving solutions on asked questions, third congrats as i can pick up that you have learned alot in last few days and trying different scenarios & fourth good luck for your future.

Coming back to you question:
I think you got confused with Modular Driven  & Page Object Model, as the above example you have given us is a part of Page Object model (POM). POM helps us to identify objects. Where as Modular Driven Framework (MDF) is something in which we combine the series of steps and rather calling the each of the steps one by one we just call that modular part.

Now, if we take the same example of our Framework, you can see that in the POM class of Product Listing Page ,  we are selecting product with the location of the product. Right, it is not with the product name. Means, what so ever is the first product, we will select that and like this we will select second as well. So that is the use of dynamic Page Objects.

I am happy to see that what you are trying to do here is something very userfull in test, which is verifying the product on Add to cart page. So to handle this you just need a simple trick or the way to handle the situation. There can two possible solutions to that:

First: Get the name of the first and second product by using some element.getText() or anything and store it in the same Excel file from which you are passing your other data. Once you add those product in to your cart, go to cart page, again get the name of the products from the cart page and compare the text name of the products from the Excel. Hope you get it what I am trying to say here.

Second: Create String variables on your main test script and store the name of the products on those variables and later you can easily compare the text of the variables with text of the Add to Cart page products name.

I am not intrested in giving you the code for it, as I know you would love to do this by your self.

Best Regards,
Lakshay Sharma

Professor Answered on September 9, 2014.

@Lakshay: Yes, learning many things from this forum.

Many thanks for your suggestions and I will work on these.

on September 9, 2014.

As Per Second Suggestion:Suppose, if there are more than 500 items then? any particular logic for this?.Toolsqa demo site is having less product so we can store the values, if we see in other shopping applications then we can see more products. Here need to know how to handle multiple data.Please let me know.

on September 13, 2014.
Add Comment

Your Answer

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