Deleting a record from gridview

how can i add a test case to delete one record from a gridview
(my doubt is if you run the test case first time it will delete that record and second time if u run the same test case how it will delete the second record instead of first one)

Without more information all i can tell you is maybe this will help you

Please provide more information so we can help you (html code , screenshot of the object ,etc…) follow this guide

there are 5 rows in a table.if i run the test case it should delete the row which has the value ‘abc’ as Employee id in it

Hi chithram

It should work by modifying the XPATH with these conditions. Example:

1. Using starts-with ‘abc’ text

//h2[starts-with(text(),‘abc’)]

2 elements matching.

2. Using contains ‘abc’ text

//h2[text()[contains(.,‘abc’)]]
//*[text()[contains(.,‘abc’)]]

3 elements matching.

Am absolutely new to this tool and what i know is just to record and play.may i know where i should add this xpath condition?is it on delete button object xpath?


Hi chithram, for the XPATH you can put it in the Object Repository and from the test case you can call it by the object location as below:

WebUI.click(findTestObject('Test Objects/Pages/Login Page/elContinue'))

I recommend to use the Record Web for the simple steps, and then you can see an example test case and object position.

1 Like