TheOne23 Posted June 24, 2022 Share Posted June 24, 2022 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 comment Share on other sites More sharing options...
Danp2 Posted June 24, 2022 Share Posted June 24, 2022 (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, 2022 by Danp2 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
TheOne23 Posted June 28, 2022 Author Share Posted June 28, 2022 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 comment Share on other sites More sharing options...
Danp2 Posted June 28, 2022 Share Posted June 28, 2022 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. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
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