开发者

How to find and delete a specific record in table/grid using Selenium

开发者 https://www.devze.com 2023-03-27 04:40 出处:网络
Assume that, a page contains a table of records (created dynamically) with Delete, Edit and View options (for each row/record). Now i want to find a specific record with name/id and delete that record

Assume that, a page contains a table of records (created dynamically) with Delete, Edit and View options (for each row/record). Now i want to find a specific record with name/id and delete that record. Is this possible in Selenium?

Help me to resolve t开发者_高级运维his! Thanks in Advance.


Sure, we do this all the time in our tests. You need to write an element locator that finds the row you want and identifies the appropriate button, then just Selenium.Click(...) on it. The exact locator value will depend on your application, but it will probably be something like xpath=//path/to/table/tr[td[pos() = 1 AND text() = 'My Name']]/td/button[@value='Delete']. In other words, "the button with the value 'Delete' in the row that has 'My Name' in its first cell in the table".

0

精彩评论

暂无评论...
验证码 换一张
取 消