-2

I have component with identifier "data-component=order-button_guid"

I would like to generate Xpath like

"//*[@data-component='order-button']+applicationId"

to have it in form order-button_xxxx-xxx-xxx-xxxxxxxx

Tommet
  • 23
  • 5
  • 1
    Possible duplicate of [How to pass variable parameter into XPath expression?](https://stackoverflow.com/questions/30352671/how-to-pass-variable-parameter-into-xpath-expression) – kjhughes Aug 21 '17 at 12:58

1 Answers1

0

Concatenate the GUID with the xpath before the single quote(') as below.

driver.findElement(By.Xpath("//*[@data-component='order-button+applicationId+']"))
Auro Sarma
  • 441
  • 2
  • 12