Add variable to findElement sting


I’m able to find the text of the following element:
sCellValue = driver.findElement(“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?

Add Comment
  • 1 Answer(s)
    Best answer

    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(“mypage:formid:relatedScenaiosListId:SceTable:”+z+“:j_id47”)).getText();

    Train Answered on October 20, 2015.

    Initially you can do a find elements for the Size ,So that you can loop accordingly.

    on October 20, 2015.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.