Z
Z
ZaurK2017-02-05 21:55:30
JavaScript
ZaurK, 2017-02-05 21:55:30

How to get to the third element in casperjs?

Hello! I have the following html structure

<table cellpadding="0" cellspacing="0" class="nomenc_table">
  <tbody><tr class="nomenc_tr_1">
    <td class="nomenc_title">Manufacturer</td>
    <td class="nomenc_text">A.C.C.&amp;S.</td>
  </tr>
  <tr class="nomenc_tr_2">
    <td class="nomenc_title">Description</td>
    <td class="nomenc_text">Flexible shaft coupling, Type C : clamp style, size : 17, left bore =  3 mm,right bore = 3 mm</td>
  </tr>
  <tr class="nomenc_tr_1">
    <td class="nomenc_title">Part number</td>
    <td class="nomenc_text">C172903000300</td>
  </tr>
  </tbody></table>

I'm trying to get this "C172903000300" value from the code using casperjs:
var npm = this.getHTML('td.nomenc_text:nth-child(2)');

It doesn't work, it returns the first value of similar ones. Tried last-child, still not right. Tell me how to get what you want?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
coderisimo, 2017-02-05
@ZaurK

Isn't it necessary to write td.nomenc_text:nth-child(3) to get the third value from the selection?
ZY XPath tried?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question