M
M
medvedgoff2021-10-21 17:30:45
XPath
medvedgoff, 2021-10-21 17:30:45

How to cut a line in a specific div using xpath for datacol?

On the product list page, each product card has two different divs, but similar in internals, in which the same line for cutting product_rest="\d{1,}" (the first div may not have it, the second one always has it)

<div class="input_more" >
куча различных данных, включая 
product_rest="16"
</div>

<div class="input_main" >
куча различных данных, включая 
product_rest="1"
<div>


here you need to get the value from the 2nd div input_main
Prescribed XPATH cut //div[@class="input_main"]
and in the cut line product_rest="\d{1,}"

does not help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Sundukov, 2021-10-22
@alekciy

XPath is well suited for navigating and filtering the DOM tree. Therefore, the first part of the task - to find divs, he can solve. And then you already need to use regular expressions to cut the desired substring.
In general, XPath has functions for working with strings and regular expressions, but they do not work well. Therefore, this part needs to be implemented in your language through regular expressions by getting the contents of the div through XPath as a string.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question