-1

How can I pass/use a parameter1 value into another parameter2 xpath ?

  • Robot framework:${number} set variable 3 xpath=xpath/1/2/${number} – Wojtek T Nov 5 at 10:21
  • 5
    Which programming language? Which library or framework? – dzieciou Nov 5 at 11:17
1

XPath is basically a function which takes string as an argument. You can use the concatenate multiple strings functionality of the language you are using.

For example in Java, you can concatenate multiple strings using +. You can do the same thing here with XPath.

WebElement element1 = driver.findElement(By.xpath("//td[normalize-space(text())='test']/a"));
String value = element1.getAttribute("value")
WebElement element2 = driver.findElement(By.xpath("//td[normalize-space(text())='" + value + "']/a"));

Not the answer you're looking for? Browse other questions tagged or ask your own question.