From: David Mullet Date: 2009-09-01T21:40:34+09:00 Subject: Re: Activate radio button (win32ole) Df Gh wrote: > Hi there folks! > I am trying to automate a browser task with win32ole. The browser is > Internet Explorer. > > I used this tutorial: > http://rubyonwindows.blogspot.com/2007/05/automating-internet-explorer-with-ruby_20.html > > So the code for clicking a normal button goes like > > require 'win32ole' > ie = WIN32OLE.new('InternetExplorer.Application') > ie.Document.All.btnG.click > > where 'bntG' is the name of the button. > > The HTML for my radio button looks like this: > > > The problem is the name="type", I think. > When I do this 'ie.Document.All.type' ooops, didn't want to know it's > type... > > Any way around this? > I'd rather not use fat libraries like watir. A group of radio buttons will probably share the same control name, so you can't reference an individual button by name. But you can iterate over the input controls and check the one with the desired value: ie.Document.All.Tags('input').each do |control| if control.value == 'reference' control.checked = true end end Let me know if that works for you. David http://rubyonwindows.blogspot.com -- Posted via http://www.ruby-forum.com/.