microsoft / WinAppDriver

Windows Application Driver
MIT License
3.66k stars 1.4k forks source link

WinAppDriver -- Select from 'List' of datatype var #551

Open sjagdish2007 opened 5 years ago

sjagdish2007 commented 5 years ago

I am assigning whatever is returned by FindElementsByClassName() method to a var. Ex: var ele1 = appWindowSession.FindElementByClassName("").FindElementByName("")

At this point ele1 has a count of 3 objects.

I know I can access each object from ele1 by using a foreach loop.

But I was wondering if there is any shortcut to access say the third object in ele1.

hassanuz commented 5 years ago

Hi @sjagdish2007,

Yes there is an example on how to do this here.

Essentially,

     var textBoxes = session.FindElementsByClassName("TextBox");
            textBoxElement1 = textBoxes[0];
            textBoxElement2 = textBoxes[1];