F
F
Fazik7772018-01-13 19:28:38
Test Driven Development
Fazik777, 2018-01-13 19:28:38

How to iterate elements on an HTML page by class without referring to the full name, but only to the beginning?

There is a site https://ru.investing.com/economic-calendar/
There are lines in the HTML code:

spoiler
<tr id="eventRowId_359644" class="js-event-item" event_attr_id="223" data-event-datetime="2018/01/11 16:30:00">
  
  <td class="first left time js-time" title="Данные вышли 5ч 31м назад">16:30</td>

  <td class="left flagCur noWrap"><span title="Канада" class="ceFlags Canada" data-img_key="Canada">&nbsp;</span> CAD</td>

  <td class="left textNum sentiment noWrap" title="Умеренная волатильность" data-img_key="bull2"><i class="grayFullBullishIcon"></i><i class="grayFullBullishIcon"></i><i class="grayEmptyBullishIcon"></i></td>
  <td class="left event" title="Для получения дополнительной информации нажмите здесь"><a href="https://ru.investing.com/economic-calendar/new-housing-price-index-223" target="_blank">
  Индекс цен на новое жилье (м/м)  (нояб)</a>
  </td>
  <td class="bold act redFont event-359644-actual" title="Хуже ожидаемого" id="eventActual_359644">0,1%</td>
  <td class="fore  event-359644-forecast " id="eventForecast_359644">0,2%</td>
  <td class="prev blackFont  event-359644-previous" id="eventPrevious_359644"><span title="">0,1%</span></td>
  <td class="alert js-injected-user-alert-container " data-name="Индекс цен на новое жилье" data-event-id="223" data-status-enabled="0">

  <span class="alertBellGrayPlus genToolTip oneliner" data-tooltip="Создать уведомление" data-tooltip-alt="Уведомление активно"></span>
    </td>
  </tr>

How to loop through elements on a page with a class like "bold act redFont event-359644-actual" but not using #id (in this case 359644) accessing only the beginning of the name, without 359644.
Select element from them by serial number [i] and set variable a to title (in this case "Worse than expected")
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-01-13
@dimonchik2013

write xpath how you iterate

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question