From: Phil Mcdonnell Date: 2010-05-24T16:36:15+09:00 Subject: Re: Scrape javascript content This is extremely helpful! With Watir I'm running into a problem finding the image button for login on the following page: https://online.americanexpress.com/myca/logon/us/action?request_type=LogonHandler&Face=en_US&DestPage=https%3A%2F%2Fwww99.americanexpress.com%2Fmyca%2Facctsumm%2Fus%2Faction%3Frequest_type%3Dauthreg_acctAccountSummary%26us_nu%3Dlogincontrol It looks like the login button is just a clickable image and I should be able to find it via: browser.button(:alt, "Login").click Any idea why that doesn't find the button? David Wright wrote: > Mechanize cannot execute javascript but watir/celerity can. (I've never > used harmony) > > #in watir (could also use firewatir and/or the safari equivalent) > require 'watir' > require 'watir/ie' > > # should work identically with celerity > #require 'celerity > #@browser = Celerity::IE.new > > @login_page = 'http://example.com/' > > @browser = Watir::IE.new > @browser.goto @login_page > @browser.text_field(:name, 'username').set(@user) > @browser.text_field(:name, 'password').set(@pass) > @browser.button(:value, "LogIn").click > > # go to page where the javascript link is > @broswer.link(:text, "Link Name").click > > # click it > # this assumes the fireClick event is 'just' an ajax call which returns > content > @broswer.link(:id, "iroc_0").click > @browser.wait # wait for ajax to return > > # show page's displaying text (not view source) > puts @browser.text > # if above fires a pop up window more code is needed to retrieve the > content -- Posted via http://www.ruby-forum.com/.