what are the approaches to check delete functionality in selenium web driver

there is a grid where there are records with delete icon (in each row). if we click on delete icon the record is deleted. now using selenium webdriver. i think we can test by verifying the message after the deletion and verifying the database. my question is what is the best way to implement the asserts in order to cover both the conditions.

[consider asserts in testNG]

Add Comment
  • 2 Answer(s)

    Hi Dear,
    you can do one thing.
    get the webelement of delete button and then verify it with assert using assert method ‘assertequal(<true>,<webelement.isdisplayed()>)’.

    like this way if webelement is deleted then it will not be displayed and hence verified via assert.

    Train Answered on May 31, 2016.
    Add Comment

    Hi Amol,

    You can do it as below.

    1. Count the number of delete buttons available in the beginning = initial count.

    2. Click the delete button and assert the count = current count.

    3. If initial count  < current count, we can confirm that the delete functionality is working.

    Doctor Answered on June 16, 2016.
    Add Comment
  • Your Answer

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