3
When IDs are dynamic (frequently database IDs) you can use the following strategies (listed in preferred order) to locate the element:
Add data attributes to existing elements in the source, e.g. data-product='first'
Add additional elements and/or attributes (e.g. name=) as fixed identifiers to the source
Use text content to identify the element
Use the ...
answered Mar 25 '19 at 10:59
Michael Durrant
22.6k22 gold badges3232 silver badges9797 bronze badges
1
Whenever Id's are dynamic then CSS selector is the best way to locate an element, but if you want to use Xpath then you can use Dynamic Xpath methods like:-
Using single attribute (//tagname[@attribute-name = 'value']).
Using multiple attribute (//tagname[@attribute-name1 = 'value1'][@attribute-name2='value2']).
Using contains method (//tagname[...
1
If your question is about how to send a HTTP POST request with JSON body from JSR223 Sampler, kindly find example code below:
import org.apache.http.client.methods.HttpPost
import org.apache.http.entity.ContentType
import org.apache.http.entity.StringEntity
import org.apache.http.impl.client.HttpClientBuilder
import org.apache.http.util.EntityUtils
def ...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
ajax × 3selenium-webdriver × 2
automated-testing × 1
jmeter × 1
selenium2 × 1
performance × 1
xpath × 1
eclipse × 1
integration-testing × 1