TheOne23 7 Posted June 24 Share Posted June 24 Hi Danp2, May I seek your expertise on how can I do the below looping script in chrome automation. For $oInput In $oInputs while $oInput.classname = "main-data-table dark-footer-enabled l-scroll-table-stretch data-table l-scroll-table column-picker-toggle ember-view" ;"main-data-table l-scroll-table-stretch data-table l-scroll-table column-picker-toggle ember-view" $sTxt = $oInput.id ;MsgBox(0,"",$sTxt) ;local $open = FileOpen(@scriptdir & "\ember.txt",9) ;FileWrite($open,$sTxt) ;FileClose($open) ExitLoop WEnd Next Link to post Share on other sites
Danp2 1,277 Posted June 24 Share Posted June 24 (edited) You could try something like this -- $sClass = "main-data-table dark-footer-enabled l-scroll-table-stretch data-table l-scroll-table column-picker-toggle ember-view" $sXpath = '//div[@class="' & $sClass & '"]' $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sXpath, Default, True) The resulting array would contain element IDs for all matching DIV elements. Edited June 28 by Danp2 WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
TheOne23 7 Posted June 28 Author Share Posted June 28 Hi Danp2, Thank you for the quick response. I will definitely try this one. I have a question actually just to have a learning how this line will do a loop to all matching DIV elements? $sClass = "main-data-table dark-footer-enabled l-scroll-table-stretch data-table l-scroll-table column-picker-toggle ember-view" = '//div[@class="' & $sClass & '"]' Thank you once again in advance Link to post Share on other sites
Danp2 1,277 Posted June 28 Share Posted June 28 There was an error in the 2nd line of the above code (missing variable name), which I just fixed. There isn't any looping in this code. The first two lines are building the correct xpath for the desired elements. The last line retrieves them with _WD_FindElement. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
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