Reputation: 109
For example:
for(int i=1;i<=2;i++){
WebElement points = driver.findElement(By.id("id["+i+"]"));
points.getCssValues("margin-bottom");
}
In the above example, margin get have two values. how to print these values in single cell.
Upvotes: 0
Views: 593
Reputation: 23825
In this code, get margin bottom for two web elements. These two web element's margin have to print in single cell
You're question is not much clear, but I think you want to get css values from multiple element into single variable and then want to use somewhere.
You need concatenate elements margin css values then print where you want as below :-
String margin= "";
for(int i=1;i<=2;i++)
{
WebElement points = driver.findElement(By.id("id["+i+"]"));
margin += points.getCssValues("margin-bottom");
}
System.out.println(margin); // this would print both margin into single
Upvotes: 1