<?xml version="1.0" encoding="UTF-8"?>
<div id="app" class="grid bg-local font-body justify-center" style="background-image: url("/img/picture.jpg");">
<div data-v-f7g8b83d=" " data-fruit-code="**I WANT TO GET WHAT'S IN HERE**" class="note relative bg-background items-center select-none w-56 sm:w-64 pb-4" style="transform: rotate(6deg);"/>
<div data-v-f7g8b83d=" " data-fruit-code="**I WANT TO GET WHAT'S IN HERE 1**" class="note relative bg-background items-center select-none w-56 sm:w-64 pb-4" style="transform: rotate(6deg);"/>
<div data-v-f7g8b83d=" " data-fruit-code="**I WANT TO GET WHAT'S IN HERE 2**" class="note relative bg-background items-center select-none w-56 sm:w-64 pb-4" style="transform: rotate(6deg);"/>
<div data-v-f7g8b83d=" " data-fruit-code="**I WANT TO GET WHAT'S IN HERE 3**" class="note relative bg-background items-center select-none w-56 sm:w-64 pb-4" style="transform: rotate(6deg);"/>
<div data-v-f7g8b83d=" " data-fruit-code="**I WANT TO GET WHAT'S IN HERE 4**" class="note relative bg-background items-center select-none w-56 sm:w-64 pb-4" style="transform: rotate(6deg);"/>
</div>
I am currently developing a web scraping bot to extract specific information from a website. My goal is to retrieve the text that corresponds to the attribute "data-fruit-code".
After trying different XPATH commands like:
//*[@id="app"]/div[2]/div
and
//*[@data-fruit-code]
I found that both of them highlighted the entire div instead of just extracting the "data-fruit-code" text I needed. I suspect there might be an error in my XPATH command. What adjustments can I make to accurately capture only the "data-fruit-code" text?
I experimented with adding functions like text() and word(), but unfortunately, they did not yield the desired results.
For assistance, I referred to resources such as: