A
A
Alexander2022-02-12 10:04:07
XPath
Alexander, 2022-02-12 10:04:07

How to get multiple elements using XPath?

How to get the contents of element1 and element3 using XPath? Does the sample page look something like this?

<div class="container">
  <div class ="element1">
     <p>Привет!</p>
 </div>
  <div class ="element2">
     <div clas ="text"> Что нового?
     </div>
  </div>
  <div class ="element3"> 
     <div clas ="text"> Как дела?
     </div>`
  </div>
  <div class ="element4"></div>
  <div class ="element5"></div>
</div>

I wanted to get all the content of only divs with class element1 and element3.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2022-02-12
@poshuriku

The screen code is bad manners . because not to copy for the test, but only the moose will type.
this time.
and two - you were not taught in logical operators?
Tipo so, did not check: //div[@class = ("element1", "element2")]depends on the xpath version.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question