Well, my problem is this. I want to gather data from a web page using python and selenium, here is the html i need to get data from
<div class="order-detail order-price">
<div>
<p class="item-left text--semibold">
Subtotal
</p>
<p class="item-right text--semibold">$1420.00</p>
</div>
</div>
<The data i need is the inner text from the last "p" element, the number. I can use the Xpath for that one specific, but this is inside a ul elemten which has a lot of li elements, inside those li, you have that div code.
The problem is that the Xpath of that div changes in every li because i can have more or less div before that one specific, so i can not use Xpath, i dont have an id, a name and the class name is equal to all other div and my program can not grab one specific. Also, i need to grab one by one so i can have them order because every once in a while i have to gather another specific div and save that data in the same spot. This is my code so far
ul_principal = driver.find_element_by_xpath('/html/body/main/div[5]/section/div/div/div/div/ul/li[2]/div/div/div[1]/div[4]/ul[2]')
li_options = ul_principal.find_elements_by_tag_name('li')
for li in li_options:
driver.implicitly_wait(100)
li.click()
div_Subtotal = li.find.element_by_class_name("order=detail order-price")
if div_Subtotal is not None:
div_Subtotal.find_element_by_class_name("item-right text--semibold").get_property('innerText')
i use li.click() to know if i can travel within the li, this works, but i can not grab the info. I can not give you the web page because its behind a password and it is private