0

I am trying to access the table row data which is under the table body.

Following is my HTML:

    <div class="panel panel-default" id="confirmationNotificationPanel">
                <div class="panel-heading">
                    <h3 class="panel-title pull-left">Patient Confirmation Notifications</h3>
                    <button type="button" class="btn btn-success btn-xs pull-right" onclick="createConfirmationNotification()"><i class="fa fa-plus-circle"></i> Add New</button>
                    <div class="clearfix"></div>
                </div>
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover">
                        <tbody id="confirmationNotificationTableBody">
        **<tr id="confirmationNotification49" data-id="49">**
            <td style="width: 180px;">
                <select id="confirmationNotificationSource49" class="form-control" style="display: inline-block;">
                    <option value="CALL">CALL</option>
                    <option value="SMS">SMS</option>
                    <option value="EMAIL">EMAIL</option>
                    <option value="APP">APP/SMS</option>
                    <option value="WHATSAPP">WHATSAPP/SMS</option>
                </select>
            </td>

I only want to get the data-id value of the table row. I am using the CSS Extractor but not able to access that data-id value. I also tried with other extractors but not able to access the same.

0
0

Depending on what you're trying to achieve the approaches will differ.

An example setup of the CSS Selector Extractor which will return data-id attribute for tr tag having id of confirmationNotificationSource49 will be something like:

  • Selector: tr[id=confirmationNotification49]
  • Attribute: data-id

Demo (assumes "CSS Selector Tester" mode of the View Results Tree listener):

enter image description here

More information: How to Use the CSS/JQuery Extractor in JMeter

4
  • Thanks, @Dmitri T but the id value is dynamic. I mean to say is that If I delete this id and create a new record, in that case, the value of it will be different. How to access that id dynamically? – Anil Kumar Oct 30 '18 at 9:38
  • If only 49 is dynamic you can amend the expression to look for row ids which start with confirmationNotification, in this case the Selector would be tr[id^=confirmationNotification] – Dmitri T Oct 30 '18 at 9:47
  • It is not working showing match count 0. – Anil Kumar Oct 30 '18 at 9:54
  • I cannot help without seeing how you configured JMeter, for me it works fine, I used Dummy Sampler to respond with the data you provided and the View Results Tree listener to visualize the result of the CSS selector – Dmitri T Oct 30 '18 at 10:28

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.