I just need the syntax for Autohotkey to get the size of a table rows/column
I am following this guide https://www.guru99.com/handling-dynamic-selenium-webdriver.html
In other languages they suggest this:
Code: Select all
WebElement tbody = driver.findElement(By.xpath("//div[@class='z-listbox-body']/table/tbody"));
List<WebElement> rows = tbody.findElements(By.xpath("tr"));
totalrows = rows.size();
This is the page I am doing test on, but can't get it to work
http://demo.guru99.com/test/web-table-element.php#
I just need to know how many rows and/or columns it has, it should be as simple as this:
Code: Select all
MsgBox % "" oChrome.findElementByXpath("//*[@id='leftcontainer']/table/thead/tr/th").size()
Or even this, like there they suggested (https://stackoverflow.com/questions/57237659/how-to-get-the-total-number-of-elements-in-a-html-with-selenium-webdriver-and-au)
Code: Select all
MsgBox % "" oChrome.findElementByXpath("//*[@id='leftcontainer']/table/thead/tr/th").Count()
The goals is to have the number of columns (in this case 5) and Rows (26), this, in order to further fo a For Each and loop through the values of each row
I would appreciate any kinds of suggestions, thanks!
Full Code
Code: Select all
oChrome := ChromeGet() ; Object for Chrome
MsgBox % "" oChrome.findElementByXpath("//*[@id='leftcontainer']/table/thead/tr/th").Size() ; FAIL
MsgBox % "Finish"
return
ChromeGet(IP_Port := "127.0.0.1:9222") {
oChrome := ComObjCreate("Selenium.ChromeDriver")
oChrome.SetCapability("debuggerAddress", IP_Port)
oChrome.Start()
return oChrome
}