From: Michael Fellinger on 20 May 2010 13:15 On Fri, May 21, 2010 at 1:14 AM, Phil Mcdonnell <phil.a.mcdonnell(a)gmail.com> wrote: > The other trick here is that this page is behind a login. Â Mechanize > allows me to fill out the login form and holds onto the login > credentials for me. Â Can harmony/celebrity/watir do this? Watir definitely does that since it simply controls your browser and therefore behaves exactly like one. >> >> The *really* interesting part is what does the Javascript do :-) with >> (a potentially large) effort you may be able to "reverse-engineer" the >> javascript and emulate manually in mechanize. Â I.e. if the javascript >> builds a simple HTTP request, you may be able to send the same request >> from mechanize (possibly) without much effort. > > How would one do this? Â I'm somewhat new to javascript as I usually > don't do front end engineering. Â I see the below definition of this > function in the HTML page. Â Any way I can sniff out what it's actually > doing? Â I'm looking to figure out what the fireClick method displays
From: David Wright on 20 May 2010 13:19 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/.
From: Phil Mcdonnell on 24 May 2010 03:36 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/.
From: brabuhr on 24 May 2010 10:32 On Mon, May 24, 2010 at 3:36 AM, Phil Mcdonnell <phil.a.mcdonnell(a)gmail.com> wrote: > 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? Sorry, don't have time to look at the page right now, but if it "is just a clickable image" and not an actual "button" watir's button helper may not find it (even though it looks like a button) so try browser.image().click?
From: Darryl Brown on 26 May 2010 15:44 On May 24, 10:32 am, brab...(a)gmail.com wrote: > On Mon, May 24, 2010 at 3:36 AM, Phil Mcdonnell > > <phil.a.mcdonn...(a)gmail.com> wrote: > > 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=.... > > > 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? > > Sorry, don't have time to look at the page right now, but if it "is > just a clickable image" and not an actual "button" watir's button > helper may not find it (even though it looks like a button) so try > browser.image().click? To click on this with Watir: You can use: @browser.button(:src, 'https://online.americanexpress.com/myca/logon/ us/shared/images/btn_login.gif').click This was captured using the Webmetrics script recorder http://www.webmetrics.com/products/script_recorder.html It has a Watir compatible mode. You won't get a working script out of it but it good for identifying objects. Inspect Element using FireBug: <input type="image" border="0" onclick="javascript:loginNow();return false;" tabindex="5" style="margin-top: 5px; margin-left: 20px; margin- bottom: 22px;" alt="Login" src="/myca/logon/us/shared/images/ btn_login.gif"> A nice helper tool for identify page object such as this Webmetrics Good luck, Darryl
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: XmlSimple not working Next: passing values from partial to controller |