Home > Mobile >  How to validate that number of rows in the table should match the number of additions performed By C
How to validate that number of rows in the table should match the number of additions performed By C

Time:06-23

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..!

CodePudding user response:

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

Log To Console | ${Length}

CodePudding user response:

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))
  • Related