I am trying to read the values from this screen( Sections appears dynamically it can be more than one). We have to read each field like Local Radios, MAC Address, Version from G
Since you have tagged Robot Framework, i'll give a robot specific solution here:
${legal_key}= Get Text xpath://td[text()='Local Radios']
${legal_value}= Get Text xpath://td[text()='Local Radios']/following-sibling::td
Similarly for all the other fields you want.
To retrieve each field like Local Radios, MAC Address, Version from General Application Statistic and the field Default Geo Code from Legacy Configuration you can use the following code block :
List<WebElement> all_items1 = driver.findElements(By.xpath("//table[@class='tabletext']/tbody//tr//td//table//tbody//tr//td[contains(.,'General Application Statistics')]//following::td"));
List<String> properties = new ArrayList<String>(3);
List<String> values = new ArrayList<String>(3);
for (int i=0;i<all_items.size();i=i+2)
properties.add(all_items.get(i).getAttribute("innerHTML"));
for (int j=1;j<all_items.size();j=j+2)
values.add(all_items.get(j).getAttribute("innerHTML"));
for (int k=0;k<properties.size();k++)
System.out.println("Property " + properties.get(k) + " has a value of " + values.get(k));
List<WebElement> all_items2 = driver.findElements(By.xpath("//table[@class='tabletext']/tbody//tr//td//table//tbody//tr//td[contains(.,'Legacy Configuration')]//following::td"));
List<String> properties = new ArrayList<String>(1);
List<String> values = new ArrayList<String>(1);
for (int i=0;i<all_items.size();i=i+2)
properties.add(all_items.get(i).getAttribute("innerHTML"));
for (int j=1;j<all_items.size();j=j+2)
values.add(all_items.get(j).getAttribute("innerHTML"));
for (int k=0;k<properties.size();k++)
System.out.println("Property " + properties.get(k) + " has a value of " + values.get(k));