Module17: exercise5-Bigbasket | Selenium Forum
M
Posted on 14/10/2016
Hi Ashish,

Number of products are 20
Number of buttons in screen are 20 (button name is "Add")
[attachment=2:14om2ltv]bigbasket-Addbutton.png[/attachment:14om2ltv]

After clicking on "Add" button, it is invisible/replaced with some other text

[attachment=1:14om2ltv]Bigbasket-button name replaced.png[/attachment:14om2ltv]

I tried to compare products in arraylist with actual products on screen and click on "Add" button against that particular product.

As both products & button size are same, i used below logic.


[attachment=0:14om2ltv]bigbasket.png[/attachment:14om2ltv]

but later identified that as and when "Add" button is clicked, button size is also reduced.

In for loop, if product name matches with product in screen, then tried to click on "Add" button against that particular product.
for e.g. If 3rd product matches then clicked on 3rd button. but as and when 3rd button is clicked, button size is reduced to 19 from 20
Due to this there is mismatch in indexation of product & buttons and unable to click on "Add" button against exact product

can you please guide me in solving this issue?

M
Replied on 15/10/2016

you can use if statement or try catch block to check index mismatch.

the actual logic you have to make it yourself.