1

I have an xpath:

//*[@id='00QE000000gQ9fv_ACTION_COLUMN']/a[2]/span

in this xpath 00QE000000gQ9fv is dynamic and _ACTION_COLUMN remains the same. I stored 00QE000000gQ9fv in a String variable as recordId i.e:

String recordId = 00QE000000gQ9fv 

Now I want an xpath that contains recordId variable.

3

Create a string variable and use it (for example) as follows:

string strMyXPath = "//*[@id='" + recordId + "_ACTION_COLUMN']/a[2]/span";
driver.FindElement(By.XPath(strMyXPath)).Click();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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