Jump to content

Chrome Automation Inquiry - Looping in all <Div> to check classname


Recommended Posts

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

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 by Danp2
Link to post
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...