Xpath issues - How to loop?

bambinou

Client
Регистрация
22.08.2011
Сообщения
442
Благодарностей
21
Баллы
18
Hi all,

I cannot remember how to loop through an xpath to get the data:
eg:
First XPath
//*[@id="main"]/div[1]/div[1]/div[1]/ul/li[1]/div[1]/div[1]/div[7]/div [1]/div[1]/div[1]/span[1]/span[1]/a/span[1]/span[1]

Second Xpath
//*[@id="main"]/div[1]/div[1]/div[1]/ul/li[2]/div[1]/div[1]/div[7]/div [1]/div[1]/div[1]/span[1]/span[1]/a/span[1]/span[1]

As you can see the /li[n] is different on each line.


I know for example that each page will have 10 of them, how can I go from:
//*[@id="main"]/div[1]/div[1]/div[1]/ul/ li[1 ]/div[1]/div[1]/div[7]/div [1]/div[1]/div[1]/span[1]/span[1]/a/span[1]/span[1]


to

//*[@id="main"]/div[1]/div[1]/div[1]/ul/ li[10] /div[1]/div[1]/div[7]/div [1]/div[1]/div[1]/span[1]/span[1]/a/span[1]/span[1]


With a block (And which block to use please.

I am using the latest version that has just been released. 7.0.2 I think.


Thanks!
 

Katana

Client
Регистрация
28.03.2021
Сообщения
84
Благодарностей
7
Баллы
8
Hi,
can you give me the links so i can tell you how to do it?

if you use the "to the action designer" and select with the XPath?

then you create a counter with an increment up to 10 and you paste your counter in your variable /li[{counter}]
but I'm not sure it works that way.

It seems to me that I had succeeded once with a window that appeared once I had created the data collection window, you could change the value in the next window. I'll take a screenshot for you later. I have a scrapping in progress
 
  • Спасибо
Реакции: bambinou

bambinou

Client
Регистрация
22.08.2011
Сообщения
442
Благодарностей
21
Баллы
18
Thank you so much, this is exactly what I needed :-)
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)