MJCS
MJCS

Reputation: 139

Referencing a div title class with xpath selenium python

So I have started messing around with Selenium in python and I am just not able to figure this xpath out.

<div title class="popupBox" style="left: 0px; to p: 490px;">
   <svg class="cp Drag" viewbox="0 0 24 24" style="height: 10px; width: 10px;">...</svg>
   <div title class="eqBox">
      <div title class="ib cp">
         <img title src="src.svg">
         <div title class="bred"></div>
         <div title class="ds2">+1</div>
         <div title class="ds3 IQ">TOP</div>
      </div>
   </div>

I need to be able to locate the TOP and get the result of TOP.

Hopefully that makes sense and I provided what is needed.

Upvotes: 0

Views: 30

Answers (1)

Md. Fazlul Hoque
Md. Fazlul Hoque

Reputation: 16189

Try:

driver.find_element(By.XPATH, '//*[@class="ds3 IQ"]').text.splitlines[-1]

Upvotes: 1

Related Questions