RohanM Posted July 2, 2022 Posted July 2, 2022 Hi , I want to iterate through child DIV elements inside the div element that I have selected by _WD_FindElement, basically I want to select main div and need to loop through the child div elements and get the values. I do not know how to do this please someone help me. Local $oDivContainers = _WD_FindElement($Session, $_WD_LOCATOR_ByXPath, "(//div[(@class='grid-container full')])[2]") <div class="grid-container full"> <div class="grid-x grid-padding-x"> <div class="cell small-12 large-3 cell--one"> <div class="msc-flow-tracking-container__cell msc-flow-tracking-container__cell--first"> <div class="msc-flow-tracking-container__data"> <span class="icon-container"></span> <div> <span class="data-heading"> Container </span> <span class="data-value" x-text="container.ContainerNumber">EADC8882965</span> </div> </div> </div> </div> <div class="cell small-12 large-2 cell--two" x-show="container.PodEtaDate"> <div class="msc-flow-tracking-container__cell"> <div class="msc-flow-tracking-container__data"> <span class="icon-c-transit-time"></span> <div> <span class="data-heading"> POD ETA </span> <span class="data-value" x-text="container.PodEtaDate">06/07/2022</span> </div> </div> </div> </div> <div class="cell small-12 large-2 cell--three"> <div class="msc-flow-tracking-container__cell"> <div class="msc-flow-tracking-container__data"> <span class="icon-type"></span> <div> <span class="data-heading"> Type </span> <span class="data-value" x-text="container.ContainerType">40' HIGH CUBE</span> </div> </div> </div> </div> <div class="cell small-12 large-3 cell--four" :class="{'large-offset-2' : !container.PodEtaDate}"> <div class="msc-flow-tracking-container__cell msc-flow-tracking-container__cell--delivered"> <div class="msc-flow-tracking-container__data"> <span class="icon-marker"></span> <div> <span class="data-heading"> Latest move </span> <span class="data-value" x-text="container.LatestMove">ANTWERP, BE</span> </div> </div> </div> </div> <div class="cell small-12 large-2 cell--five"> <div class="msc-flow-tracking-container__cell msc-flow-tracking-container__cell--last"> <button class="msc-flow-tracking-container__more-button msc-cta-arrow msc-cta-arrow--simple open" :class="{'complete': isComplete, 'open': open}" :disabled="orderedEvents.length === 0"></button> </div> </div> </div> </div>
Danp2 Posted July 2, 2022 Posted July 2, 2022 _WD_FindElement will return an array of matching elements if you call it will the proper parameters. See the WD help file for details. Latest Webdriver UDF Release Webdriver Wiki FAQs
RohanM Posted July 3, 2022 Author Posted July 3, 2022 Hi @Danp2 I think you means this way Local $Elements = _WD_FindElement($Session, $_WD_LOCATOR_ByXPath, "//div[contains(@class,'cell small-12 large-')]", Default, True) is there is any way to get the all child element which are pertaining to give DIV, I want to capture main DVI "<div class="cell small-12 large-2" (multiple) DIVs and then want to loop through inside elements. <div class="cell small-12 large-2 cell--two" x-show="container.PodEtaDate"> <div class="msc-flow-tracking-container__cell"> <div class="msc-flow-tracking-container__data"> <span class="icon-c-transit-time"></span> <div> <span class="data-heading"> POD ETA </span> <span class="data-value" x-text="container.PodEtaDate">06/07/2022</span> </div> </div> </div> </div> <div class="cell small-12 large-2 cell--three"> <div class="msc-flow-tracking-container__cell"> <div class="msc-flow-tracking-container__data"> <span class="icon-type"></span> <div> <span class="data-heading"> Type </span> <span class="data-value" x-text="container.ContainerType">40' HIGH CUBE</span> </div> </div> </div> </div>
Danp2 Posted July 3, 2022 Posted July 3, 2022 37 minutes ago, RohanM said: is there is any way to get the all child element which are pertaining to give DIV, You should be able to get the child DIV elements by adjusting your xpath to something like this -- Local $sElements = _WD_FindElement($Session, $_WD_LOCATOR_ByXPath, "//div[contains(@class,'cell small-12 large-')]/div", Default, True) Latest Webdriver UDF Release Webdriver Wiki FAQs
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now