0
votes

I am using the JMeter with Groovy for developing the Client side scripts. I am not sure how to given the name for below dynamic element variable. Please kindly advise.

findElement(By.xpath("(//button[@type='button'])[30]")).click();

I have tried below element name but didn't work. [error] Implicit Wait timed out after 10000ms [error] Element //div[contains(@class,'el-button--')]/li/div not found

enter image description here

enter image description here

enter image description here

1

1 Answers

0
votes
  1. Locate the <span> element with text OK
  2. Locate its parent - it will be the <button> you're looking for

Something like:

findElement(By.xpath("//span[contains(text(), 'OK')]/parent::button")).click()

If there is more than one span with text OK you will have to figure out the way to uniquely identify the particular button you want to click.

You may find Using the XPath Extractor in JMeter article useful, it's mainly for JMeter's XPath Extractor, but the syntax will be the same for the WebDriver Sampler when it comes to XPath language evaluation.