HI, POPUP DOENT CLICK NOTHING IN NOTEPAD. WINDOWHELPER.RB:--
class WindowHelper def initialize( ) @autoit = WIN32OLE.new('AutoItX3.Control') end def push_alert_button @autoit.WinWait "Windows Internet Explorer", "" text = @autoit.WinGetText "Windows Internet Explorer" file = File.open("c:\\popup.txt", "w") file.puts text file.close @autoit.Send "{ENTER}" end def push_confirm_button_ok @autoit.WinWait "Microsoft Internet Explorer", "" @autoit.Send "{ENTER}" end def push_confirm_button_cancel @autoit.WinWait "Microsoft Internet Explorer", "" @autoit.Send "{ESCAPE}" end def push_security_alert_yes @autoit.WinWait "Security Alert", "" @autoit.Send "{TAB}" @autoit.Send "{TAB}" @autoit.Send "{SPACE}" end def logon(title,name = 'john doe',password = 'john doe') @autoit.WinWait title, "" @autoit.Send name @autoit.Send "{TAB}" @autoit.Send password @autoit.Send "{ENTER}" end def WindowHelper.check_autoit_installed begin WIN32OLE.new('AutoItX3.Control') rescue raise Watir::Exception::WatirException, "The AutoIt dll must be correctly registered for this feature to work properly" end end end REGARDS SHALINI GUPTA On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
Hi, Few more questions: 1. Did pop up gets clicked or not? 2. If notepad or wordpad opens what are its contents? 3. Can you post the code for modified WindowHelper.rb file? Regards, Angrez On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote: > > HI, > > YES I HAVE MODIFIED THAT > > REGARDS > SHALINI > On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > Did you modified WindowHelper.rb file? You need to update > > push_alert_button method to log the text of pop up to file c:\test.txt. > > > > Regards, > > Angrez > > > > On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote: > > > > > hi, > > > i have used ur code as.. > > > Yes note pad opens.. > > > but nothing is gone in to this > > > > > > now im getting these errors:- > > > 1) Error: > > > test_PSCLogin(TC_PSC_userlogin): > > > EOFError: end of file reached > > > pop_chk.rb:45:in `readline' > > > pop_chk.rb:45:in `read_js_popup_contents' > > > pop_chk.rb:100:in `test_PSCLogin' > > > > > > > > > > > > class TC_PSC_userlogin < Test::Unit::TestCase > > > def start_jsalert_clicker > > > Thread.new{ system("ruby \"c:\\PSC\\jscriptExtraAlert.rb\"") > > > } > > > end > > > # read file contents > > > def read_js_popup_contents > > > file = File.open("c:\\test.txt") > > > lines = file.readline > > > while lines == "" > > > lines = file.readline > > > end > > > lines = file.readlines > > > file.close > > > return lines > > > end > > > > > > - Show quoted text - > > > def start > > > #open the IE browser > > > $ie = IE.new > > > > > > #create a logger > > > filePrefix = "logger" > > > $logger = LoggerFactory.start_xml_logger(filePrefix) > > > $ie.set_logger($logger) > > > > > > ##Excel file functions > > > $lgn=Excel_file.new #making object of workbookfunction > > > $wrk_sht=$lgn.ExcelOpen("c:\\PSC\\PSCuserlogin.xls") > > > > > > ##java popup hadling > > > #$pop=Jave_PopUps.new ##making object of javapopup > > > #$oPopup = Watir::autoit > > > end > > > > > > def test_PSCLogin > > > > > > > > > #call start method... > > > start #fires up the IE browser and a logger object > > > > > > #variables-URL > > > test_site = ' https://www.philipnow.com/envcss/ ' > > > $logger.log("## PSCUser_Login_Logoff_4") > > > $logger.log("") > > > $logger.log("Description- Do not enter anything in the E-mail > > > Address and Password field and click Login button.") #logs only to > > > corelogger file > > > $logger.log("Expected Output-The user should not be able to > > > login.") > > > $logger.log("") > > > $logger.log("Step 1: Go to the Philipnow.com<http://philipnow.com/>:- 'https://www.philipnow.com/envcss/'<https://www.philipnow.com/envcss/%27> > > > ") > > > $ie.goto(test_site) > > > $logger.log(" Action-1: entered " + test_site + " in the address > > > bar.") > > > $logger.log(":Step 2: Do not enter any thing in user id") > > > val_userid=$lgn.TakeData("a",1,$wrk_sht) > > > $ie.text_field(:name, "username").set(val_userid.to_s) > > > $logger.log(" Action-2: entered Nothing in in e-mail address") > > > > > > $logger.log(":Step-3: Do not enter any thing in password field") > > > val_password=$lgn.TakeData("b",1,$wrk_sht) > > > $ie.text_field(:name,"password").set(val_password.to_s) > > > $logger.log(":Action-3: entered Nothing in password field") > > > > > > start_jsalert_clicker > > > $ie.button(:name, "login").click > > > read_js_popup_contents > > > > > > begin > > > assert($ie.contains_text("Welcome to Client Self-service > > > Portal, Alex Reyes!") ) > > > $logger.log("*FAILED*." + e.message + "\n" + > > > e.backtrace.join("\n")) > > > $logger.log("Test Failed:Expected result has not been > > > achieved:- User is able to login ") > > > $logger.log_results( > > > "PSCUser_Login_Logoff_4","Description-Do not enter anything in the E-mail > > > Address and Password field and click Login button.","Expected Output-The > > > user should not be able to login.","TEST FAILED:") #logs to both the XML > > > file and corelogger > > > rescue => e > > > $logger.log("Test Passed:Expected result has been > > > achieved:- User is not able to login ") > > > $logger.log_results( > > > "PSCUser_Login_Logoff_4","Description-Do not enter anything in the E-mail > > > Address and Password field and click Login button.","Expected Output-The > > > user should not be able to login.","TEST PASSED:") #logs to both the XML > > > file and corelogger > > > end > > > > > > $ie.close > > > $logger.log("Close excel file") > > > $lgn.excel_close > > > $logger.log("Closed excel file") > > > $logger.log "## End of test: PSC login\n" > > > end > > > end > > > > > > Regards > > > Shalini Gupta > > > > > > _______________________________________________ > > > Wtr-general mailing list > > > Wtr-general@rubyforge.org > > > http://rubyforge.org/mailman/listinfo/wtr-general > > > > > > > > > _______________________________________________ > > Wtr-general mailing list > > Wtr-general@rubyforge.org > > http://rubyforge.org/mailman/listinfo/wtr-general > > > > > _______________________________________________ > Wtr-general mailing list > Wtr-general@rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > _______________________________________________ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general