Add variable to findElement sting
I’m able to find the text of the following element:
sCellValue = driver.findElement(By.id(“mypage:formid:relatedScenaiosListId:SceTable:1:j_id47”)).getText();
Now I want to loop through the table to find all it’s elements. It increments using SceTable:1 , the next is SceTable:2 and so on. Can I somehow variableize this value or do I need to use an xpath statement?
So I think I found the answer.
I created an int z variable and added a for loop just to see how it works. I wasn’t sure of the syntax. I also need to parameterize the id47 since it also increments.
sCellValue = driver.findElement(By.id(“mypage:formid:relatedScenaiosListId:SceTable:”+z+“:j_id47”)).getText();