Guys, I tried all these for below given requirements but no value:
ie = Watir::IE.new test_site='https://secure.qa2.mlb.com/enterworkflow.do? flowId=registration.ajax.wizard&c_id=mlb' ie.goto(test_site) ie.radio(:id, 'select_register').set ie.text_field(:id, "register_email").set("ver...@mailinator.com") ie.button(:id, 'submit_btn').click_no_wait prompt_message = " The form was not submitted because of the following error(s)." window_title = "Microsoft Internet Explorer" popup_dialog = WIN32OLE.new("AutoItX3.Control") sleep 9 text = popup_dialog.WinGetText(window_title, "") puts text popup_dialog.ControlClick("", "", "[CLASS:Button; TEXT:OK; INSTANCE: 1]") sleep 5 And require 'watir' require 'win32ole' require 'watir/ie' require 'watir\contrib\enabled_popup' require 'watir/dialog' require 'rubygems' ie = Watir::IE.new test_site='https://secure.qa2.mlb.com/enterworkflow.do? flowId=registration.ajax.wizard&c_id=mlb' ie.goto(test_site) ie.radio(:id, 'select_register').set ie.text_field(:id, "register_email").set("ver...@mailinator.com") ie.button(:id, 'submit_btn').click_no_wait txt = ie.clickprompt() #this clicks the ok button and returns puts txt On Aug 3, 5:02 pm, Dheeraj Gambhir <checktestingthi...@gmail.com> wrote: > Hi All, > If you have free time, please try the case given below: > > a) Go > tohttps://secure.mlb.com/enterworkflow.do?flowId=registration.ajax.wiza... > b) select "I don't have MLB account" > c) Enter email-address and click "Register" button > d) It shows you error pop-up, i want the text of that pop-up > e) Then on the same page, Enter email-address, password and click > "Register" button.It shows you another error pop-up, i want the text > of this pop-up now. > > I tried auto it but it works at times then suddenly it stops working. > Please ;et me know if any body has any rational solution of it. > > Thanks > D G > > On Jul 31, 9:28 pm, Felipe Knorr Kuhn <fkn...@gmail.com> wrote: > > > Hello, > > > I forgot the following include > > > require 'win32/registry' > > > FK > > > On Fri, Jul 31, 2009 at 8:06 AM, Dheeraj Gambhir < > > > checktestingthi...@gmail.com> wrote: > > > Felipe: > > > > I tried this and got this error: > > > > C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependenci > > > es.rb:440:in `load_missing_constant': uninitialized constant > > > Win32::Registry (Na > > > meError) > > > from > > > C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo > > > rt/dependencies.rb:80:in `const_missing' > > > from ./picktextpop.rb:16:in `click_window_button' > > > from testpicktextpop.rb:19 > > > > My code goes like: > > > > #------------------------------------------------------------------------------------------------------------# > > > #includes > > > require 'watir' > > > require 'win32ole' > > > require 'watir/ie' > > > require 'watir\contrib\enabled_popup' > > > require 'picktextpop' > > > > # open the IE browser > > > ie = Watir::IE.new > > > test_site=' > > >https://secure.qa2.mlb.com/enterworkflow.do?flowId=registration.ajax.... > > > ' > > > ie.goto(test_site) > > > if ie.contains_text("MLB.com account") > > > ie.radio(:id, 'select_register').set > > > ie.text_field(:id, "register_email").set("ver...@mailinator.com") > > > ie.button(:id, "submit_btn").click_no_wait > > > click_window_button "The form was not submitted because of the > > > following error(s).", "OK" > > > ie.waitForIE > > > else > > > end > > > > And picktextpop contains: > > > > #Encoding > > > $KCODE = "u" > > > WIN32OLE.codepage = WIN32OLE::CP_UTF8 > > > > require 'iconv' > > > > def converte str > > > Iconv.conv('CP1252', 'UTF-8', str) > > > end > > > > # Click the button in the window with said text > > > def click_window_button txtWindow, txtButton > > > # Find out IE version > > > reg_val = '' > > > key = 'Software\Microsoft\Internet Explorer' > > > Win32::Registry::HKEY_LOCAL_MACHINE.open(key) do |reg| > > > reg_typ, reg_val = reg.read('Version') > > > end > > > > @ie_ver, ie_ver2, ie_ver3, ie_ver4 = reg_val.split('.') > > > @autoit = WIN32OLE.new('AutoItX3.Control') > > > > if (@ie_ver == "7") > > > @windowCaption = "Windows Internet Explorer" > > > else > > > @windowCaption = "Microsoft Internet Explorer" > > > end > > > > # Wait for the popup > > > loop do > > > sleep(5) > > > @text = @autoit.ControlGetText(@windowCaption, "", "Static2") > > > if (@text != nil) > > > @text = converte(@text) > > > puts "[INFO " + Time.now.strftime("%H:%M:%S") + "] Text found: " + > > > @text > > > end > > > if (@text == txtWindow) > > > puts "[INFO " + Time.now.strftime("%H:%M:%S") + "] Clicking button > > > - > > > " + txtWindow > > > @autoit.ControlClick(@windowCaption,'', txtButton) > > > break > > > end > > > end > > > end > > > > Please have a look and see if you can help further. > > > > When it clicked "Register" button, pop-up gets hides and it gives error on > > > console. > > > > On Fri, Jul 31, 2009 at 3:53 PM, Dheeraj Gambhir < > > > checktestingthi...@gmail.com> wrote: > > > >> Hey Felipe , > > > >> First of all big thnx for replying, i will try this code ASAP and then > > >> let > > >> u know if stuck again. > > > >> Regarding Oracle/Ruby connectivity, i faced too many issues but at last > > >> had no option so uninstall and reinstall oracle client. From then > > >> onwards, > > >> it is working fine. Fingers cross :) > > > >> Thnx once again. > > > >> On Thu, Jul 30, 2009 at 6:40 PM, Felipe Knorr Kuhn > > >> <fkn...@gmail.com>wrote: > > > >>> Hello Dheeraj, > > > >>> I defined the function in the end of this message to click on button > > >>> "txtButton" when the alert has text equal to "txtWindow" > > > >>> You call it with: > > > >>> @main.button(:name, "CONFIRM").click_no_wait > > >>> clica_window_BUTTON "Are you sure do you want to confirm?", "OK" > > >>> @ie.waitForIE > > > >>> The code that really matters to you is @text = > > >>> @autoit.ControlGetText(@windowCaption, "", "Static2") > > > >>> Then you compare the @text string against what you want > > >>> (@text.include?("Username required") for example) > > > >>> PS: Do you mind sharing what you've done to get Oracle working? > > > >>> Hope that helps, > > > >>> FK > > > >>> ------ > > > >>> CODE: > > > >>> #Encoding > > >>> $KCODE = "u" > > >>> WIN32OLE.codepage = WIN32OLE::CP_UTF8 > > > >>> require 'iconv' > > > >>> def converte str > > >>> Iconv.conv('CP1252', 'UTF-8', str) > > >>> end > > > >>> # Click the button in the window with said text > > >>> def click_window_button txtWindow, txtButton > > >>> # Find out IE version > > >>> reg_val = '' > > >>> key = 'Software\Microsoft\Internet Explorer' > > >>> Win32::Registry::HKEY_LOCAL_MACHINE.open(key) do |reg| > > >>> reg_typ, reg_val = reg.read('Version') > > >>> end > > > >>> @ie_ver, ie_ver2, ie_ver3, ie_ver4 = reg_val.split('.') > > >>> @autoit = WIN32OLE.new('AutoItX3.Control') > > > >>> if (@ie_ver == "7") > > >>> @windowCaption = "Windows Internet Explorer" > > >>> else > > >>> @windowCaption = "Microsoft Internet Explorer" > > >>> end > > > >>> # Wait for the popup > > >>> loop do > > >>> sleep(5) > > >>> @text = @autoit.ControlGetText(@windowCaption, "", "Static2") > > >>> if (@text != nil) > > >>> @text = converte(@text) > > >>> puts "[INFO " + Time.now.strftime("%H:%M:%S") + "] Text found: " > > >>> + > > >>> @text > > >>> end > > >>> if (@text == txtWindow) > > >>> puts "[INFO " + Time.now.strftime("%H:%M:%S") + "] Clicking > > >>> button > > >>> - " + txtWindow > > >>> @autoit.ControlClick(@windowCaption,'', txtButton) > > >>> break > > >>> end > > >>> end > > >>> end > > > >>> On Thu, Jul 30, 2009 at 9:47 AM, Dheeraj Gambhir < > > >>> checktestingthi...@gmail.com> wrote: > > > >>>> My bad Chuck, sorry for posting two problem at one go. > > > >>>> Ruby/Oracle connectivity thing is working fine for me now. > > > >>>> The only limitation pending is: > > > >>>> On Login page, when we submit the form without entering > > >>>> "confirm password" value, it gives pop-up message i.e "Confirm > > >>>> Password- Entry Required.", same is the case with other validations. > > > >>>> My requirement is to pick that pop-up message text. > > > >>>> Is it possible? > > > >>>> Please help if you can. > > > >>>> On Jul 22, 9:44 pm, Chuck van der Linden <sqa...@gmail.com> wrote: > > >>>> > Firstly, please do not ask two questions that are not related in a > > >>>> > single thread. This is no different than asking a new unrelated > > >>>> > question in an existing thread. it makes things much too confusing > > >>>> > for everyone, and harder for anyone coming here and searching for > > >>>> > answers to find what they need. > > > >>>> > You already have a thread about connecting to oracle, seek the answer > > >>>> > to that issue there instead of starting a duplicate thread on the > > >>>> > same > > >>>> > subject which just fragments things and again makes it harder for > > >>>> > everyone. > > > >>>> > Secondly with regard to dealing with popups, did you read this > > >>>> > instruction? > > >>>> > 1. Before you ask anything, please search in the group at first, you > > >>>> > maygetgreat answers, that would save your time a lot. > > > >>>> > how to deal with Pop-ups (responding to them, verifying the > > >>>> > happened, > > >>>> > etc) is a topic that has been discussed at length in both the wiki/ > > >>>> > tutorials and also in very recent subject threads here in the group. > > >>>> > It is one of the MOST COMMON TOPICS discussed here. So, 'The Answer > > >>>> > You Seek' (tm) is likely already here and you could have had it > > >>>> > already without having to wait (perhaps for someone in another > > >>>> > timezone who is currently sleeping when you post your message, who is > > >>>> > more than likely going to refer you to the existing thread that you > > >>>> > could have found yourself with just a little work on your part.) > > > >>>> > Don't keep posting the same thing over and over and over.. it > > >>>> won'tgetyou an answer any sooner. If there was someone awake and able/ > > >>>> > inclined to respond to your original posting they would have done so. > > >>>> > Posting again in an hour or two just means more stuff for people to > > >>>> > wade through. Furthermore it's the kind of behavior that can cause > > >>>> > other folks to 'flip the twit bit' on you and write you off as some > > >>>> > kind of impatient idiot. > > > >>>> > SO, if you have searched, and read the tutorials, and tried the > > >>>> > things > > >>>> > there, then please, Tell us what you've tried and what the results > > >>>> > were.. otherwise we're going to assume you've not even tried > > >>>> > searching, or will end up suggesting a lot of things you may have > > >>>> > already tried which wastes your and our time. > > > >>>> > Nobody is paid to respond here.. we all do it on our own time, and > > >>>> > after a while of answering the same questions over and over many > > >>>> > folks > > >>>> > rapidlygetto a point where they are dis-inclined to help > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---