Skip to main content
added 62 characters in body
Source Link
João Farias
  • 11k
  • 2
  • 20
  • 40

My code is :

for (int z = 0; z < rows.size(); z++) {

rows.get(z).findElement(By.xpath("//[@class='ng-scope'][" + (z + 1) + "]//[@placeholder='Stop Name']")).sendKeys(shuttleObj.getStopArea());

}

for (int z = 0; z < rows.size(); z++) {

rows.get(z).findElement(By.xpath("//*[@class='ng-scope'][" + (z + 1) + "]//*[@placeholder='Stop Name']")).sendKeys(shuttleObj.getStopArea());

}

And I want to use repository to pass xpath. I want this value multiple times for every rows in a table but if I am taking properties like

for (int z = 0; z < rows.size(); z++) {

rows.get(z).findElement(By.xpath(props.getProperty("path[" + (z + 1) + "]area")).sendKeys(shuttleObj.getStopArea()));

}

path=//[@class='ng-scope'] area=//[@placeholder='Stop Name']

for (int z = 0; z < rows.size(); z++) {

rows.get(z).findElement(By.xpath(props.getProperty("path[" + (z + 1) + "]area")).sendKeys(shuttleObj.getStopArea()));

}

path=//*[@class='ng-scope']
area=//*[@placeholder='Stop Name']

This code is not working. If I am taking total elements like

path=//[@class='ng-scope'][" + (z + 1) + "]//[@placeholder='Stop Name']

path=//*[@class='ng-scope'][" + (z + 1) + "]//*[@placeholder='Stop Name']

It can be able to run but in same row. But I want this value in every rows in a table.

My code is :

for (int z = 0; z < rows.size(); z++) {

rows.get(z).findElement(By.xpath("//[@class='ng-scope'][" + (z + 1) + "]//[@placeholder='Stop Name']")).sendKeys(shuttleObj.getStopArea());

}

And I want to use repository to pass xpath. I want this value multiple times for every rows in a table but if I am taking properties like

for (int z = 0; z < rows.size(); z++) {

rows.get(z).findElement(By.xpath(props.getProperty("path[" + (z + 1) + "]area")).sendKeys(shuttleObj.getStopArea()));

}

path=//[@class='ng-scope'] area=//[@placeholder='Stop Name']

This code is not working. If I am taking total elements like

path=//[@class='ng-scope'][" + (z + 1) + "]//[@placeholder='Stop Name']

It can be able to run but in same row. But I want this value in every rows in a table.

My code is :

for (int z = 0; z < rows.size(); z++) {

rows.get(z).findElement(By.xpath("//*[@class='ng-scope'][" + (z + 1) + "]//*[@placeholder='Stop Name']")).sendKeys(shuttleObj.getStopArea());

}

And I want to use repository to pass xpath. I want this value multiple times for every rows in a table but if I am taking properties like

for (int z = 0; z < rows.size(); z++) {

rows.get(z).findElement(By.xpath(props.getProperty("path[" + (z + 1) + "]area")).sendKeys(shuttleObj.getStopArea()));

}

path=//*[@class='ng-scope']
area=//*[@placeholder='Stop Name']

This code is not working. If I am taking total elements like

path=//*[@class='ng-scope'][" + (z + 1) + "]//*[@placeholder='Stop Name']

It can be able to run but in same row. But I want this value in every rows in a table.

Source Link

Unable to pass dynamic xpath in repository file?

My code is :

for (int z = 0; z < rows.size(); z++) {

rows.get(z).findElement(By.xpath("//[@class='ng-scope'][" + (z + 1) + "]//[@placeholder='Stop Name']")).sendKeys(shuttleObj.getStopArea());

}

And I want to use repository to pass xpath. I want this value multiple times for every rows in a table but if I am taking properties like

for (int z = 0; z < rows.size(); z++) {

rows.get(z).findElement(By.xpath(props.getProperty("path[" + (z + 1) + "]area")).sendKeys(shuttleObj.getStopArea()));

}

path=//[@class='ng-scope'] area=//[@placeholder='Stop Name']

This code is not working. If I am taking total elements like

path=//[@class='ng-scope'][" + (z + 1) + "]//[@placeholder='Stop Name']

It can be able to run but in same row. But I want this value in every rows in a table.