B
B
buk962019-01-09 17:06:26
XPath
buk96, 2019-01-09 17:06:26

How to parse "Color" in table from div using xpath for datacol?

Need xpath for datacol.
Table code example

<div class="item-card-detailed__table">
  <div class="item-card-detailed__table_column">
    <div class="item-card-detailed__table_item">Длина (см)</div>
        <div class="item-card-detailed__table_item">Ширина (см)</div>
        <div class="item-card-detailed__table_item">Высота (см)</div>
        <div class="item-card-detailed__table_item">Материал</div>
        <div class="item-card-detailed__table_item">Цвет</div>
        <div class="item-card-detailed__table_item">Вес (кг)</div>
        <div class="item-card-detailed__table_item">Стили</div>
  </div>
  <div class="item-card-detailed__table_column item-card-detailed__table_column-second">
        <div class="item-card-detailed__table_item">62</div>
        <div class="item-card-detailed__table_item">56</div>
        <div class="item-card-detailed__table_item">85</div>
        <div class="item-card-detailed__table_item">Ткань</div>
        <div class="item-card-detailed__table_item">Бежевый</div>
        <div class="item-card-detailed__table_item">11</div>
        <div class="item-card-detailed__table_item">Прованс, Скандинавский</div>
  </div>
</div>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Fov, 2019-01-10
@buk96

Use nested queries and the task becomes quite trivial:
XPath

//div[@class = 'item-card-detailed__table_column item-card-detailed__table_column-second']/div[position() = count(//div[@class = 'item-card-detailed__table_column']/div[text() = 'Цвет']/preceding-sibling::div)+1]

I
Ivan, 2019-01-09
@Iv_and_S

if it's just <body>then:
"/html/body/div/div[2]/div[5]/text()"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question