i wonder if something like this should be added to watir:
ie.active_element which returns the element with the focus as a watir object. Its harder to acheive than what you have, but maybe more usable Paul ----- Original Message ----- From: "Mike Ramsey" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, March 08, 2007 4:06 PM Subject: Re: [Wtr-general] Identifying the id of the element with focus after a tab > >Date: Thu, 08 Mar 2007 09:17:09 -0700 >>From: Paul Rogers <[EMAIL PROTECTED]> >>Subject: Re: [Wtr-general] Identifying the id of the element with >> >>there is a method ie.show_active >> >>that might do what you need >> >>Paul > > Paul, > I added the following to watir.rb > > # Return the element Id of the widget with focus > def get_Id_with_focus > > p = nil > begin > current = document.activeElement > p = current.invoke("id") > rescue > #activeElement doesn't have an id > end > return p > end > > This appears to be doing the trick. Thank you! > > Next task is to integrate this into an assertFocus command that can be > invoked from faucets .... > > --Thanks again, > --Mike Ramsey > > >>From: Charley Baker >>Sent: Thursday, March 08, 2007 8:53 AM >>Subject: Re: [Wtr-general] Identifying the id of the element with focus > >>after a tab >> >> Hi Mike, >> >> When you're using AutoIt, you're working with windows controls, not >>html elements per se. There's no way that I'm aware of that you can > easily >get the html element id using AutoIt. It recognizes windows, > controls and >identifies them by using Window handles, text and the > like. There's some >code in watir.rb that uses window handles to access > JSButtons with >WinClicker. >> >> -Charley > > Charley, > Thank you. I do appreciate the problem. Not all HTML Elements will > have ids so handles may be the ultimate answer. It would be a good > thing if AutoIt and watir behaved better on the playground. > > --Thanks again, > --Mike Ramsey > _______________________________________________ > Wtr-general mailing list > [email protected] > http://rubyforge.org/mailman/listinfo/wtr-general > _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
