I am having the below table with five columns. out of five columns column#5 have image icon which changes randomly with back-end data.Image don't have id or class which is static.
CSS as below:
With below code I able to get column#4 text.
var temp = driverIE.FindElement
(By.XPath("//td[@class ='af_column_cell-text OraTableBorder1111'][4]"))
.GetAttribute("innerText");
I tried to get image tags alt
or title
with below code but it's returning null.
var temp = driverIE.FindElement
(By.XPath("//td[@class ='af_column_cell-text OraTableBorder1111'][5]/img"))
.GetAttribute("alt");
I am trying to get title
or alt
value to a temporary variable. Further I have to divert control to different method as per value.
For the people who may face this issue, adding the solution.
Before:
var temp = driverIE.FindElement
(By.XPath("//td[@class ='af_column_cell-text OraTableBorder1111'][5]/img"))
.GetAttribute("alt");
After:
var temp = driverIE.FindElement
(By.XPath("//td[@class ='af_column_cell-text OraTableBorder1111'][5]//img"))
.GetAttribute("alt");