复杂 XPath - 编写引用另一个元素的 XPath

发布于 2025-01-10 21:45:39 字数 29149 浏览 0 评论 0原文

有一张桌子。该表是一个父 div。该父级 div 有两个子级。第一个子 div 是表头,第二个子 div 包含表头的值。

父项以粗体突出显示,子项以斜体粗体突出显示。

<div class="sc-jgHCyG eZqcrI"> // >>>>>>> Parent div
    <div class="sc-cTkwdZ fFvlhF"> // >>>>>>>>>>>> child div - containing table headers
        <div class="sc-cBNfnY sc-eggNIi kHBkvh JiLrb align-items-center justify-content-between" draggable="false"
             width="1.8050541516245486">
            <div class="sc-iWFSnp cmuvkJ">
                <div></div>
            </div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Ticket</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi gRDfhj JiLrb align-items-center justify-content-between" draggable="true"
             width="10.108303249097473">
            <div class="sc-iWFSnp cmuvkJ">
                <div class="sc-citwmv kajamm"><img draggable="false" src="/static/media/drag-indicator.5c17cc6e.svg"
                                                   alt="drag"></div>
                <div>Date</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi bPRqpN JiLrb align-items-center justify-content-between" draggable="true"
             width="8.664259927797833">
            <div class="sc-iWFSnp cmuvkJ">
                <div class="sc-citwmv kajamm"><img draggable="false" src="/static/media/drag-indicator.5c17cc6e.svg"
                                                   alt="drag"></div>
                <div>Customer Name</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="true"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div class="sc-citwmv kajamm"><img draggable="false" src="/static/media/drag-indicator.5c17cc6e.svg"
                                                   alt="drag"></div>
                <div>Supplier</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="true"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div class="sc-citwmv kajamm"><img draggable="false" src="/static/media/drag-indicator.5c17cc6e.svg"
                                                   alt="drag"></div>
                <div>Material</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Quantity</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="true"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div class="sc-citwmv kajamm"><img draggable="false" src="/static/media/drag-indicator.5c17cc6e.svg"
                                                   alt="drag"></div>
                <div>Status</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Hauler</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Field Temp</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Gross</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Tare</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Net</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi jHksBY JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Max GVW</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
    </div>
    <div> // >>>>>>>>>>>>>>>> second child div 
        <div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701236" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701236</div>
                </div>
                <div title="2021-01-03T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2021-01-03 10:30:00 am">2021-01-03 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="NH 9.5 75G" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>NH 9.5 75G</div>
                </div>
                <div title="24.13" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>24.13</div>
                </div>
                <div title="delivered" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>delivered</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="90" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>90</div>
                </div>
                <div title="39.39" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>39.39</div>
                </div>
                <div title="15.26" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>15.26</div>
                </div>
                <div title="24.13" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>24.13</div>
                </div>
                <div title="753962" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>753962</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701235" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701235</div>
                </div>
                <div title="2021-01-02T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2021-01-02 10:30:00 am">2021-01-02 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="NH 9.5 75G" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>NH 9.5 75G</div>
                </div>
                <div title="29.36" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>29.36</div>
                </div>
                <div title="delivered" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>delivered</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="77" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>77</div>
                </div>
                <div title="43.19" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>43.19</div>
                </div>
                <div title="13.83" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>13.83</div>
                </div>
                <div title="29.36" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>29.36</div>
                </div>
                <div title="96026" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>96026</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701234" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701234</div>
                </div>
                <div title="2021-01-01T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2021-01-01 10:30:00 am">2021-01-01 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="NH 9.5 75G" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>NH 9.5 75G</div>
                </div>
                <div title="14.1" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>14.1</div>
                </div>
                <div title="delivered" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>delivered</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="34" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>34</div>
                </div>
                <div title="26.25" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>26.25</div>
                </div>
                <div title="12.15" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>12.15</div>
                </div>
                <div title="14.1" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>14.1</div>
                </div>
                <div title="22692" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>22692</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701233" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701233</div>
                </div>
                <div title="2020-12-31T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2020-12-31 10:30:00 am">2020-12-31 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="12.5MM RECYLE LIME" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>12.5MM RECYLE LIME</div>
                </div>
                <div title="21.44" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>21.44</div>
                </div>
                <div title="delivered" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>delivered</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="98" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>98</div>
                </div>
                <div title="30.27" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>30.27</div>
                </div>
                <div title="8.83" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>8.83</div>
                </div>
                <div title="11.44" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>11.44</div>
                </div>
                <div title="564054" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>564054</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701232" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701232</div>
                </div>
                <div title="2020-12-30T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2020-12-30 10:30:00 am">2020-12-30 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="NH 9.5 75G" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>NH 9.5 75G</div>
                </div>
                <div title="29.94" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>29.94</div>
                </div>
                <div title="rejected" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>rejected</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="68" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>68</div>
                </div>
                <div title="38.91" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>38.91</div>
                </div>
                <div title="8.97" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>8.97</div>
                </div>
                <div title="29.94" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>29.94</div>
                </div>
                <div title="741980" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>741980</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701231" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701231</div>
                </div>
                <div title="2020-12-29T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2020-12-29 10:30:00 am">2020-12-29 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="NH 9.5 75G" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>NH 9.5 75G</div>
                </div>
                <div title="20.41" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>20.41</div>
                </div>
                <div title="pending" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>pending</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="31.99" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>31.99</div>
                </div>
                <div title="11.58" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>11.58</div>
                </div>
                <div title="20.41" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>20.41</div>
                </div>
                <div title="31702" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>31702</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701230" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701230</div>
                </div>
                <div title="2020-12-28T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2020-12-28 10:30:00 am">2020-12-28 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="12.5MM RECYLE LIME" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>12.5MM RECYLE LIME</div>
                </div>
                <div title="17.51" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>17.51</div>
                </div>
                <div title="voided" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>voided</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="29.99" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>29.99</div>
                </div>
                <div title="12.48" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>12.48</div>
                </div>
                <div title="17.51" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>17.51</div>
                </div>
                <div title="973479" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>973479</div>
                </div>
            </div>
        </div>
        <div></div>
    </div>
</div>

我想找出所有毛值(第 10 标题列)。总排名总是在变化。根据我想到的解决方案,我需要编写一个引用字母“Gross”的 XPath。这样即使它的位置发生变化,XPath 也能工作。

这是我写的 XPath: //div[text()='Gross']/../../../following-sibling::div//div[@class='sc-cBNfnY fhvIWI '] 它应该给出 7 个单元格(元素),但它给出了所有单元格。

如何编写一个唯一的 XPath 来提供所有 7 个毛值(表格单元格)的列表?

39.39
43.19
26.25
30.27
38.91
31.99
29.99

There is a table. This table is a parent div. This parent div has two children. The first child div is the table header and the second one contains the value of headers.

Parent highlighted in bold and children is highlighted in italics bold.

<div class="sc-jgHCyG eZqcrI"> // >>>>>>> Parent div
    <div class="sc-cTkwdZ fFvlhF"> // >>>>>>>>>>>> child div - containing table headers
        <div class="sc-cBNfnY sc-eggNIi kHBkvh JiLrb align-items-center justify-content-between" draggable="false"
             width="1.8050541516245486">
            <div class="sc-iWFSnp cmuvkJ">
                <div></div>
            </div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Ticket</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi gRDfhj JiLrb align-items-center justify-content-between" draggable="true"
             width="10.108303249097473">
            <div class="sc-iWFSnp cmuvkJ">
                <div class="sc-citwmv kajamm"><img draggable="false" src="/static/media/drag-indicator.5c17cc6e.svg"
                                                   alt="drag"></div>
                <div>Date</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi bPRqpN JiLrb align-items-center justify-content-between" draggable="true"
             width="8.664259927797833">
            <div class="sc-iWFSnp cmuvkJ">
                <div class="sc-citwmv kajamm"><img draggable="false" src="/static/media/drag-indicator.5c17cc6e.svg"
                                                   alt="drag"></div>
                <div>Customer Name</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="true"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div class="sc-citwmv kajamm"><img draggable="false" src="/static/media/drag-indicator.5c17cc6e.svg"
                                                   alt="drag"></div>
                <div>Supplier</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="true"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div class="sc-citwmv kajamm"><img draggable="false" src="/static/media/drag-indicator.5c17cc6e.svg"
                                                   alt="drag"></div>
                <div>Material</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Quantity</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="true"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div class="sc-citwmv kajamm"><img draggable="false" src="/static/media/drag-indicator.5c17cc6e.svg"
                                                   alt="drag"></div>
                <div>Status</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Hauler</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Field Temp</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Gross</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Tare</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi fhvIWI JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Net</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
        <div class="sc-cBNfnY sc-eggNIi jHksBY JiLrb align-items-center justify-content-between" draggable="false"
             width="7.2202166064981945">
            <div class="sc-iWFSnp cmuvkJ">
                <div>Max GVW</div>
            </div>
            <div><span class="sc-hTZhsR cQSaWH"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24"
                                                     aria-hidden="true"><path
                    d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></svg></span></div>
        </div>
    </div>
    <div> // >>>>>>>>>>>>>>>> second child div 
        <div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701236" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701236</div>
                </div>
                <div title="2021-01-03T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2021-01-03 10:30:00 am">2021-01-03 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="NH 9.5 75G" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>NH 9.5 75G</div>
                </div>
                <div title="24.13" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>24.13</div>
                </div>
                <div title="delivered" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>delivered</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="90" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>90</div>
                </div>
                <div title="39.39" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>39.39</div>
                </div>
                <div title="15.26" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>15.26</div>
                </div>
                <div title="24.13" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>24.13</div>
                </div>
                <div title="753962" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>753962</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701235" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701235</div>
                </div>
                <div title="2021-01-02T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2021-01-02 10:30:00 am">2021-01-02 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="NH 9.5 75G" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>NH 9.5 75G</div>
                </div>
                <div title="29.36" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>29.36</div>
                </div>
                <div title="delivered" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>delivered</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="77" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>77</div>
                </div>
                <div title="43.19" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>43.19</div>
                </div>
                <div title="13.83" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>13.83</div>
                </div>
                <div title="29.36" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>29.36</div>
                </div>
                <div title="96026" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>96026</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701234" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701234</div>
                </div>
                <div title="2021-01-01T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2021-01-01 10:30:00 am">2021-01-01 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="NH 9.5 75G" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>NH 9.5 75G</div>
                </div>
                <div title="14.1" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>14.1</div>
                </div>
                <div title="delivered" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>delivered</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="34" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>34</div>
                </div>
                <div title="26.25" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>26.25</div>
                </div>
                <div title="12.15" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>12.15</div>
                </div>
                <div title="14.1" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>14.1</div>
                </div>
                <div title="22692" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>22692</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701233" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701233</div>
                </div>
                <div title="2020-12-31T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2020-12-31 10:30:00 am">2020-12-31 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="12.5MM RECYLE LIME" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>12.5MM RECYLE LIME</div>
                </div>
                <div title="21.44" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>21.44</div>
                </div>
                <div title="delivered" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>delivered</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="98" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>98</div>
                </div>
                <div title="30.27" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>30.27</div>
                </div>
                <div title="8.83" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>8.83</div>
                </div>
                <div title="11.44" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>11.44</div>
                </div>
                <div title="564054" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>564054</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701232" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701232</div>
                </div>
                <div title="2020-12-30T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2020-12-30 10:30:00 am">2020-12-30 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="NH 9.5 75G" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>NH 9.5 75G</div>
                </div>
                <div title="29.94" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>29.94</div>
                </div>
                <div title="rejected" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>rejected</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="68" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>68</div>
                </div>
                <div title="38.91" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>38.91</div>
                </div>
                <div title="8.97" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>8.97</div>
                </div>
                <div title="29.94" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>29.94</div>
                </div>
                <div title="741980" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>741980</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701231" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701231</div>
                </div>
                <div title="2020-12-29T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2020-12-29 10:30:00 am">2020-12-29 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="NH 9.5 75G" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>NH 9.5 75G</div>
                </div>
                <div title="20.41" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>20.41</div>
                </div>
                <div title="pending" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>pending</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="31.99" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>31.99</div>
                </div>
                <div title="11.58" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>11.58</div>
                </div>
                <div title="20.41" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>20.41</div>
                </div>
                <div title="31702" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>31702</div>
                </div>
            </div>
            <div class="sc-cOajty bPLPeB d-flex">
                <div title="" width="1.8050541516245486" class="sc-cBNfnY kHBkvh">
                    <div class="mt-2"><label><input type="checkbox"></label></div>
                </div>
                <div title="48701230" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>48701230</div>
                </div>
                <div title="2020-12-28T00:00:00.000-05:00" width="10.108303249097473" class="sc-cBNfnY gRDfhj">
                    <div title="2020-12-28 10:30:00 am">2020-12-28 10:30:00 am</div>
                </div>
                <div title="Democompany" width="8.664259927797833" class="sc-cBNfnY bPRqpN">
                    <div>Democompany</div>
                </div>
                <div title="Democompany" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>Democompany</div>
                </div>
                <div title="12.5MM RECYLE LIME" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>12.5MM RECYLE LIME</div>
                </div>
                <div title="17.51" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>17.51</div>
                </div>
                <div title="voided" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>voided</div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div></div>
                </div>
                <div title="29.99" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>29.99</div>
                </div>
                <div title="12.48" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>12.48</div>
                </div>
                <div title="17.51" width="7.2202166064981945" class="sc-cBNfnY fhvIWI">
                    <div>17.51</div>
                </div>
                <div title="973479" width="7.2202166064981945" class="sc-cBNfnY jHksBY">
                    <div>973479</div>
                </div>
            </div>
        </div>
        <div></div>
    </div>
</div>

I want to find out all Gross (10th header column) values. Position Gross is always changing. Per solution I have in mind I need to write an XPath in reference to letter "Gross". So that even if its position changes, XPath will work.

This is the XPath I wrote: //div[text()='Gross']/../../../following-sibling::div//div[@class='sc-cBNfnY fhvIWI'] and it should give 7 cells (elements) but it gives all cells.

How can I write a unique XPath that will give me a list of all 7 Gross values (table cells)?

39.39
43.19
26.25
30.27
38.91
31.99
29.99

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

影子的影子 2025-01-17 21:45:39

这个将在一个 XPath 中完成这项工作,而不使用随机类名:

//div[@class[contains(.,'d-flex')]]/div[count(//div[@class[contains(.,'justify-content-between')]][contains(.,'Gross')]/preceding-sibling::*)+1]/div

This one will do the job in one XPath without using random class-names:

//div[@class[contains(.,'d-flex')]]/div[count(//div[@class[contains(.,'justify-content-between')]][contains(.,'Gross')]/preceding-sibling::*)+1]/div
独孤求败 2025-01-17 21:45:39

由于这些实际上是单独的表,因此您无法通过单个 XPath 表达式执行您想要的操作。
您可以执行以下操作:
您可以获取此 XPath 呈现 Gross 文本的列号:

column = count(//div[./div/div[text()='Gross']]/preceding-sibling::div[contains(@class,'fhvIWI'])+1

使用当前的 XML,column 为 8
在下表中获取所需的单元格

//div[@class='sc-cBNfnY fhvIWI'][column]

现在您可以使用以下表达式

//div[@class='sc-cBNfnY fhvIWI'][8]

给出以下结果:

39.39
43.19
26.25
30.27
38.91
31.99
29.99

Since these are actually separated tables you can not do what you want by a single XPath expression.
What you do can is as following:
You can get the column number where Gross text is presented by this XPath:

column = count(//div[./div/div[text()='Gross']]/preceding-sibling::div[contains(@class,'fhvIWI'])+1

With current XML the column is 8
Now you can get the desired cells in the lower table with

//div[@class='sc-cBNfnY fhvIWI'][column]

The following expression

//div[@class='sc-cBNfnY fhvIWI'][8]

Gives the following results:

39.39
43.19
26.25
30.27
38.91
31.99
29.99

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文