Find cells under a column in an HTML table with xpath?
By : user3729943
Date : March 29 2020, 07:55 AM
Hope this helps No, there is no association in xpath between column headers in a table and the column they fall within. The only way to find cells that fall beneath a specific column header is, using some other code, to count the columns (account for colspans) until the desired table header is found, and then count that many columns in each row to extract the cells.
|
I am trying to find xpath for checkbox in a table column
By : Kraggle Larner
Date : March 29 2020, 07:55 AM
should help you out I am trying to find the Xpath for a checkbox and then click it using my Python Webdriver script. The checkbox is in a column in a table. The text for the checkbox is in another column. The text is DM. I want to click the checkbox which has the text value DM. I don't want the checkbox which has the text value ceb07_14_1504_06_52 , you have some errors your html: code :
line 39: the "td" tags must be closed
line 41: you must close the "colgroup"
content="//span[text()='DM']/../../..//input"
try:
WebDriverWait(self.driver, 10).until(lambda s: s.find_element_by_xpath(content).is_displayed())
except TimeoutError:
logging.fatal("Timeout occurred trying to search content["+content+"]")
self.driver.find_element_by_xpath(content).click()
|
C#/Selenium using XPath to find given column cells (nested XPath)
By : jessica merjil
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I am struggling with extracting some data from a datagrid with XPath in Selenium. , 2 changes: code :
foreach (var tableRowsElement in TableRowsElements)
{
ReadOnlyCollection<IWebElement> someDataElements =
tableRowsElement.FindElements(
By.XPath(".//td[currentColumnIndex]"));
}
".//tr[1]/td"
|
How to find a particular link in a table which is repeating using a particular text in a column using xpath
By : user1986801
Date : March 29 2020, 07:55 AM
With these it helps You can do this using the following XPath //td[text()='Centro comercial Moctezuma']/following-sibling::/td//i[text()='close']
|
How to use a index of colum from table find by xpath in other xpath?
By : mike rawles
Date : March 29 2020, 07:55 AM
Does that help If you want to get the address column based on phone number, here is the xpath. The xpath is dynamic so you don't have to worry thought the column positions change. code :
//table[@id='users-table']//td[.='05680' and position()=count(//th[normalize-space(.)='Phone']/preceding-sibling::th)+1]/ancestor::tr//td[position()=count(//th[normalize-space(.)='address']/preceding-sibling::th)+1]
//table[@id='users-table']//td[.='05680' and position()=count(//th[normalize-space(.)='Phone']/preceding-sibling::th)+1]/ancestor::tr//td[ .= '5 street' and position()=count(//th[normalize-space(.)='address']/preceding-sibling::th)+1]
//table[@id='users-table']//tr[td[.='05680' and position()=count(//th[normalize-space(.)='Phone']/preceding-sibling::th)+1] and td[ .= '5 street' and position()=count(//th[normalize-space(.)='address']/preceding-sibling::th)+1]]//button
td[position()=count(//th/button[@id='add-user-button']/../preceding-sibling::th)+1]
|