How to validate that number of rows in the table should match the number of additions performed By Clicking ADD button?

83 views Asked by At

How to validate that number of rows in the table should match the number of additions performed By Clicking ADD button?

Initially it will be like this...

enter image description here

Now, need to add some data as rows of this table..

enter image description here

Now, rows added.. how can I validate that how many rows are added by clicking ADD button.

Thank you..!

2

There are 2 answers

0
Abhishek K On BEST ANSWER

${Length} | get element count | {Locator}

Log To Console | ${Length}

0
Hunter G On
from selenium import webdriver
from selenium.webdriver.common import keys
driver = webdriver.Chrome (executable_path="C:\\chromedriver.exe")

driver.get("[your_webpage]")

Next, you need to tell Selenium the xPath of this specific table element.

l = driver.find_elements_by_xpath ("//*[@class= 'spTable']/tbody/tr")

print (len(l))