Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

hi,

This is my entire code...

please help!!!

CODE::---
##
//
##
## Watir script
##
##//




requires

require 'watir'
#require 'autoit'

require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'test/unit/assertions'
#require 'watir/setFileDialog'
#require 'popups_test'
#require 'enabled_popup'


#logger requires
require 'example_logger1'
require 'workbookfunction'

#java_pophadler requires
require 'WindowHelper'
require 'win32ole'
#require 'javapopup'
#require 'winClickers'




includes
include Watir


class TC_PSC_userlogin < Test::Unit::TestCase

 def startClicker( button , waitTime = 3)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)

c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button} #{waitTime}
"
puts "Starting #{c}"
w.winsystem(c)
w=nil
###end of function StartClicker
end

 def text(wait_seconds = 2)
sleep 0.3
   autoit = WIN32OLE.new("AutoItX3.Control ")
   autoit.WinWait("Microsoft Internet Explorer", nil, wait_seconds)
if wait_seconds
   s = autoit.WinGetText("Microsoft Internet Explorer")
   file = File.open ("c:\\test.txt", "w")   # DONT MAKE
YOUR VARIABLES GLOBAL UNNECESSARILY
   file.puts(s.to_s)
   puts s
   file.close
   #s unless s == "1"# NOT SURE WHY YOU ARE DOING THIS
end

  def start
  #open the IE browser
   $ie = IE.new

   #create a logger


   ##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
 :-
'https://www.philipnow.com/envcss/'
")
  $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")



popup handling#
  startClicker("OK",3)
 text(2)
  #require 'js_dialog'
  #assert_js_dialog do

$ie.button(:name, "login").click


 #end



  $logger.log(":Step-4: Click the Login button")


  $logger.log("Action-4: clicked the Login button.")






Regards
Shalini Gupta


On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


hi,

This is my entire code...

please help!!!

CODE::---

##//
##
## Watir script
##
##//




requires

require 'watir'
#require 'autoit'

require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'test/unit/assertions'
#require 'watir/setFileDialog'
#require 'popups_test'
#require 'enabled_popup'


#logger requires
require 'example_logger1'
require 'workbookfunction'

#java_pophadler requires
require 'WindowHelper'
require 'win32ole'
#require 'javapopup'
#require 'winClickers'




includes
include Watir


class TC_PSC_userlogin < Test::Unit::TestCase

  def startClicker( button , waitTime = 3)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)

c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
#{waitTime} "
puts "Starting #{c}"
w.winsystem(c)
w=nil
###end of function StartClicker
end

  def text(wait_seconds = 2)
 sleep 0.3
autoit = WIN32OLE.new("AutoItX3.Control ")
autoit.WinWait("Microsoft Internet Explorer", nil,
wait_seconds) if wait_seconds
s = autoit.WinGetText("Microsoft Internet Explorer")
file = File.open ("c:\\test.txt", "w")   # DONT MAKE
YOUR VARIABLES GLOBAL UNNECESSARILY
file.puts(s.to_s)
puts s
file.close
#s unless s == "1"# NOT SURE WHY YOU ARE DOING
THIS
end

   def start
   #open the IE browser
$ie = IE.new

#create a logger
filePrefix = "logger"
$

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

hi,
thanks
it works...
regards
shalini gupta

On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


hi,
i have made all the changes told by u..

as:-
in my ruby file :-
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

in windowhelper.rb
def push_alert_button
@autoit.WinWait "Microsoft Internet Explorer", ""
text = @ autoit.WinGetText "Microsoft Internet Explorer"
file = File.open("c:\\test.txt", "w")
file.puts text
file.close
@autoit.Send "{ENTER}"
end

but still the error is coming
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:97:in `test_PSCLogin'

1 tests, 0 assertions, 0 failures, 1 errors

regards
shalini gupta

On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
>
> HI,
> YES UR RIGHT THANKS!!
>
> REGARDS
> SHALINI GUPTA
>
> On 4/26/07, Angrez Singh < [EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > Few mistakes:
> > 1. You are adding text to file called popup.txt and reading from
> > test.txt
> >
> > 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
> > >
> > > >   # 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
> > > > > > >
> > > > > >
> > 2. In push_alert_button why the title that you are searching for is
> > "Windows Internet Explorer"? It should be "Microsoft Internet Explorer" if
> > you are using IE 6.0? That could be the reason that pop is not getting
> > clicked. If you are using IE 7.0 then the code is fine. Otherwise
> > change it.
> >
> > Let me know if changing made above made the code to work.
> >
> > - Angrez
> >
> > ___
> > 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

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

hi,
i have made all the changes told by u..

as:-
in my ruby file :-
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

in windowhelper.rb
def push_alert_button
   @autoit.WinWait "Microsoft Internet Explorer", ""
   text = @autoit.WinGetText "Microsoft Internet Explorer"
   file = File.open("c:\\test.txt", "w")
   file.puts text
   file.close
   @autoit.Send "{ENTER}"
end

but still the error is coming
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:97:in `test_PSCLogin'

1 tests, 0 assertions, 0 failures, 1 errors

regards
shalini gupta

On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


HI,
YES UR RIGHT THANKS!!

REGARDS
SHALINI GUPTA

On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Few mistakes:
> 1. You are adding text to file called popup.txt and reading from
> test.txt
>
> 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
> >
> > >   # 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
> > > > > >
> > > > >
> 2. In push_alert_button why the title that you are searching for is
> "Windows Internet Explorer"? It should be "Microsoft Internet Explorer" if
> you are using IE 6.0? That could be the reason that pop is not getting
> clicked. If you are using IE 7.0 then the code is fine. Otherwise change
> it.
>
> Let me know if changing made above made the code to work.
>
> - Angrez
>
> ___
> 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

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

HI,
YES UR RIGHT THANKS!!

REGARDS
SHALINI GUPTA

On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote:


Hi,

Few mistakes:
1. You are adding text to file called popup.txt and reading from test.txt

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
>
> >   # 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
> > > > >
> > > >
2. In push_alert_button why the title that you are searching for is
"Windows Internet Explorer"? It should be "Microsoft Internet Explorer" if
you are using IE 6.0? That could be the reason that pop is not getting
clicked. If you are using IE 7.0 then the code is fine. Otherwise change
it.

Let me know if changing made above made the code to work.

- Angrez

___
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

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread Angrez Singh

Hi,

Few mistakes:
1. You are adding text to file called popup.txt and reading from test.txt

   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

>  # 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
> > > >
> > >

2. In push_alert_button why the title that you are searching for is "Windows
Internet Explorer"? It should be "Microsoft Internet Explorer" if you are
using IE 6.0? That could be the reason that pop is not getting clicked. If
you are using IE 7.0 then the code is fine. Otherwise change it.

Let me know if changing made above made the code to work.

- Angrez
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

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:- 
'https://www.philipnow.com/envcss/'
> > > ")
> > >$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
> >

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread Angrez Singh

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:- 
'https://www.philipnow.com/envcss/'
> > ")
> >$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
>


___

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

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 :- 
'https://www.philipnow.com/envcss/'
> ")
>$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

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread Angrez Singh

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  :-
' https://www.philipnow.com/envcss/'
")
   $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

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

hi,

have i used correctly or not
..
Regards
Shalini gupta
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

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
 :-
'https://www.philipnow.com/envcss/'
")
  $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

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread Angrez Singh

hi,

Did notepad or wordpad gets open when you execute the script? I hope you
changed the path in your script before executing the script that I provided?

Can you post the contents of command prompt that you get?

Regards,
Angrez

On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:




On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:
>
> HI ALL,
> Please help!!
> its urgent!!
>
> Regards
> Shalini
>
> On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED] > wrote:
> >
> >
> >
> > -- Forwarded message --
> > From: SHALINI GUPTA <[EMAIL PROTECTED] >
> > Date: Apr 26, 2007 1:05 PM
> > Subject: Re: [Wtr-general] how to capture text from popup window
> > To: wtr-general@rubyforge.org
> >
> > HI,
> > No im not getting any exception,error..
> > but it becomes silent ...like not doing any thing...
> > just command promt remains open..
> >
> > nothing happens..
> >
> > regards
> > shalini gupta
> >
> > On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > >
> > > Did you get any exceptions, errors etc while using the code I
> > > provided?
> > >
> > > Regards,
> > > Angrez
> > >
> > > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > > >
> > > > hi,
> > > > thanks!!
> > > >
> > > > i have just started using watir.I am very new to it.
> > > > should i install autoit seperately...i think it is installed
> > > > automatically with watir.or ru talking about autoit tool..
> > > >
> > > > Regards
> > > > Shalini
> > > >
> > > > On 4/26/07, Angrez Singh < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > Simply saying its not working won't be of any help :). Did you
> > > > > get any errors, exceptions? Make sure that IE is in focus when you 
use the
> > > > > code. Is autoit installed properly? Same code works fine for me. I am 
able
> > > > > to get the text of Javascript pop up.
> > > > >
> > > > > Regards,
> > > > > Angrez
> > > > >
> > > > > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > HI,
> > > > > > Sorry..its also not working.
> > > > > > i have done all the things told by u..
> > > > > > but i think push_alert_button doesnt work.
> > > > > >
> > > > > > as i was using wincliker class to handle popup..
> > > > > > that time popup was handled properly
> > > > > >
> > > > > > but now its not working..
> > > > > >
> > > > > > my previous startClicker method is:-
> > > > > > def startClicker( button , waitTime = 3)
> > > > > > w = WinClicker.new
> > > > > > longName = $ie.dir.gsub("/" , "\\" )
> > > > > > shortName = w.getShortFileName (longName)
> > > > > >
> > > > > > c = "start ruby #{shortName}\\watir\\clickJSDialog.rb
> > > > > > #{button} #{waitTime} "
> > > > > > puts "Starting #{c}"
> > > > > > w.winsystem(c)
> > > > > > w=nil
> > > > > > #nd of function StartClicker
> > > > > > end
> > > > > >
> > > > > > Regards
> > > > > > shalini gupta
> > > > > >
> > > > > > On 4/26/07, Angrez Singh < [EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > hi,
> > > > > > >
> > > > > > > this is simplest code that you can have:
> > > > > > >
> > > > > > > start_jsalert_clicker
> > > > > > > $ie.button(:name,[some_name]).click
> > > > > > > read_js_popup_contents
> > > > > > >
> > > > > > > # This only clicks ok button. Change teh path accordingly.
> > > > > > > def start_jsalert_clicker
> > > > > > > Thread.new{ system("rubyw
> > > > > > > \"d:\\installations\\ruby\\lib\\ruby\\gems\\1.8\\gems\\watir-
> > > > > > > 1.5.1.1145\\unittests\\jscript

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


HI ALL,
Please help!!
its urgent!!

Regards
Shalini

On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED] > wrote:
>
>
>
> -- Forwarded message --
> From: SHALINI GUPTA <[EMAIL PROTECTED] >
> Date: Apr 26, 2007 1:05 PM
> Subject: Re: [Wtr-general] how to capture text from popup window
> To: wtr-general@rubyforge.org
>
> HI,
> No im not getting any exception,error..
> but it becomes silent ...like not doing any thing...
> just command promt remains open..
>
> nothing happens..
>
> regards
> shalini gupta
>
> On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > Did you get any exceptions, errors etc while using the code I
> > provided?
> >
> > Regards,
> > Angrez
> >
> > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > >
> > > hi,
> > > thanks!!
> > >
> > > i have just started using watir.I am very new to it.
> > > should i install autoit seperately...i think it is installed
> > > automatically with watir.or ru talking about autoit tool..
> > >
> > > Regards
> > > Shalini
> > >
> > > On 4/26/07, Angrez Singh < [EMAIL PROTECTED]> wrote:
> > > >
> > > > Hi,
> > > >
> > > > Simply saying its not working won't be of any help :). Did you get
> > > > any errors, exceptions? Make sure that IE is in focus when you use the 
code.
> > > > Is autoit installed properly? Same code works fine for me. I am able to 
get
> > > > the text of Javascript pop up.
> > > >
> > > > Regards,
> > > > Angrez
> > > >
> > > > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > > HI,
> > > > > Sorry..its also not working.
> > > > > i have done all the things told by u..
> > > > > but i think push_alert_button doesnt work.
> > > > >
> > > > > as i was using wincliker class to handle popup..
> > > > > that time popup was handled properly
> > > > >
> > > > > but now its not working..
> > > > >
> > > > > my previous startClicker method is:-
> > > > > def startClicker( button , waitTime = 3)
> > > > > w = WinClicker.new
> > > > > longName = $ie.dir.gsub("/" , "\\" )
> > > > > shortName = w.getShortFileName (longName)
> > > > >
> > > > > c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
> > > > > #{waitTime} "
> > > > > puts "Starting #{c}"
> > > > > w.winsystem(c)
> > > > > w=nil
> > > > > #nd of function StartClicker
> > > > > end
> > > > >
> > > > > Regards
> > > > > shalini gupta
> > > > >
> > > > > On 4/26/07, Angrez Singh < [EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > hi,
> > > > > >
> > > > > > this is simplest code that you can have:
> > > > > >
> > > > > > start_jsalert_clicker
> > > > > > $ie.button(:name,[some_name]).click
> > > > > > read_js_popup_contents
> > > > > >
> > > > > > # This only clicks ok button. Change teh path accordingly.
> > > > > > def start_jsalert_clicker
> > > > > > Thread.new{ system("rubyw
> > > > > > \"d:\\installations\\ruby\\lib\\ruby\\gems\\1.8\\gems\\watir-
> > > > > > 1.5.1.1145\\unittests\\jscriptExtraAlert.rb\"") }
> > > > > > end
> > > > > >
> > > > > > # read file contents
> > > > > > def read_js_popup_contents
> > > > > > file = File.open("c:\\popup.txt")
> > > > > > lines = file.readline
> > > > > > while lines == ""
> > > > > > lines = file.readline
> > > > > > end
> > > > > > lines = file.readlines
> > > > > > file.close
> > > > > > return lines
> > > > > > end
> > > > > >
> > > > > >
> > > > > > You need to modify WindowHelper.

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

HI,
No im not getting any exception,error..
but it becomes silent ...like not doing any thing...
just command promt remains open..

nothing happens..

regards
shalini gupta

On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote:


Hi,

Did you get any exceptions, errors etc while using the code I provided?

Regards,
Angrez

On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
>
> hi,
> thanks!!
>
> i have just started using watir.I am very new to it.
> should i install autoit seperately...i think it is installed
> automatically with watir.or ru talking about autoit tool..
>
> Regards
> Shalini
>
> On 4/26/07, Angrez Singh < [EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > Simply saying its not working won't be of any help :). Did you get any
> > errors, exceptions? Make sure that IE is in focus when you use the code. Is
> > autoit installed properly? Same code works fine for me. I am able to get the
> > text of Javascript pop up.
> >
> > Regards,
> > Angrez
> >
> > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > >
> > > HI,
> > > Sorry..its also not working.
> > > i have done all the things told by u..
> > > but i think push_alert_button doesnt work.
> > >
> > > as i was using wincliker class to handle popup..
> > > that time popup was handled properly
> > >
> > > but now its not working..
> > >
> > > my previous startClicker method is:-
> > > def startClicker( button , waitTime = 3)
> > > w = WinClicker.new
> > > longName = $ie.dir.gsub("/" , "\\" )
> > > shortName = w.getShortFileName (longName)
> > >
> > > c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
> > > #{waitTime} "
> > > puts "Starting #{c}"
> > > w.winsystem(c)
> > > w=nil
> > > #nd of function StartClicker
> > > end
> > >
> > > Regards
> > > shalini gupta
> > >
> > > On 4/26/07, Angrez Singh < [EMAIL PROTECTED]> wrote:
> > > >
> > > > hi,
> > > >
> > > > this is simplest code that you can have:
> > > >
> > > > start_jsalert_clicker
> > > > $ie.button(:name,[some_name]).click
> > > > read_js_popup_contents
> > > >
> > > > # This only clicks ok button. Change teh path accordingly.
> > > > def start_jsalert_clicker
> > > > Thread.new{ system("rubyw
> > > > \"d:\\installations\\ruby\\lib\\ruby\\gems\\1.8\\gems\\watir-
> > > > 1.5.1.1145\\unittests\\jscriptExtraAlert.rb\"") }
> > > > end
> > > >
> > > > # read file contents
> > > > def read_js_popup_contents
> > > > file = File.open("c:\\popup.txt")
> > > > lines = file.readline
> > > > while lines == ""
> > > > lines = file.readline
> > > > end
> > > > lines = file.readlines
> > > > file.close
> > > > return lines
> > > > end
> > > >
> > > >
> > > > You need to modify WindowHelper.rb (in watir directory) class to
> > > > enter text into the file before clicking OK button.
> > > >
> > > > 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
> > > >
> > > > Hope this helps
> > > >
> > > > - Angrez
> > > > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > > >
> > > > > hi,
> > > > > please some one reply..
> > > > > its urgent..
> > > > >
> > > > > Regards
> > > > > Shalini Gupta
> > > > >
> > > > > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > my code is as...
> > > > > >
> > > > > >
> > > > > > requires
> > > > > >
> > > > > > require 'watir'
> > > > > > #require 'autoit'
> > > > > >
> > > > > > require 'test/unit'
> > > > > > require 'test/unit/ui/console/testrunner'
> > > > > > require 'test/unit/assertions'
> > > > > > #require 'watir/setFileDialog'
> > > > > > #require 'popups_test'
> > > > > > #require 'enabled_popup'
> > > > > >
> > > > > >
> > > > > > #logger requires
> > > > > > require 'example_logger1'
> > > > > > require 'workbookfunction'
> > > > > >
> > > > > > #java_pophadler requires
> > > > > > require 'WindowHelper'
> > > > > > require 'win32ole'
> > > > > > #require 'javapopup'
> > > > > > #require 'winClickers'
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > includes
> > > > > > include Watir
> > > > > >
> > > > > >
> > > > > > class TC_PSC_userlogin < Test::Unit::TestCase
> > > > > >
> > > > > >   def startClicker( button , waitTime = 3)
> > > > > > w = WinClicker.new
> > > > > > longName = $ie.dir.gsub("/" , "\\" )
> > > > > > shortName = w.getShortFileName(longName)
> > > > > >
> > > > > > c = "start ruby #{shortName}\\watir\\clickJSDialog.rb
> > > > > > #{button} #{waitTime} "
> > > > > > puts "Starting #{c}"
> > > > > > w.winsystem(c)
> > > > > > w=nil
> > > > > > ###end of function StartClicker
> > > > > > end
> > > > > >
> > > > > >   def text(wait_seconds = 2)
> > > > > >  sleep 0.3
> > > > > > autoit = 

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread Angrez Singh

Hi,

Did you get any exceptions, errors etc while using the code I provided?

Regards,
Angrez

On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


hi,
thanks!!

i have just started using watir.I am very new to it.
should i install autoit seperately...i think it is installed automatically
with watir.or ru talking about autoit tool..

Regards
Shalini

On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Simply saying its not working won't be of any help :). Did you get any
> errors, exceptions? Make sure that IE is in focus when you use the code. Is
> autoit installed properly? Same code works fine for me. I am able to get the
> text of Javascript pop up.
>
> Regards,
> Angrez
>
> On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> >
> > HI,
> > Sorry..its also not working.
> > i have done all the things told by u..
> > but i think push_alert_button doesnt work.
> >
> > as i was using wincliker class to handle popup..
> > that time popup was handled properly
> >
> > but now its not working..
> >
> > my previous startClicker method is:-
> > def startClicker( button , waitTime = 3)
> > w = WinClicker.new
> > longName = $ie.dir.gsub("/" , "\\" )
> > shortName = w.getShortFileName (longName)
> >
> > c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
> > #{waitTime} "
> > puts "Starting #{c}"
> > w.winsystem(c)
> > w=nil
> > #nd of function StartClicker
> > end
> >
> > Regards
> > shalini gupta
> >
> > On 4/26/07, Angrez Singh < [EMAIL PROTECTED]> wrote:
> > >
> > > hi,
> > >
> > > this is simplest code that you can have:
> > >
> > > start_jsalert_clicker
> > > $ie.button(:name,[some_name]).click
> > > read_js_popup_contents
> > >
> > > # This only clicks ok button. Change teh path accordingly.
> > > def start_jsalert_clicker
> > > Thread.new{ system("rubyw
> > > \"d:\\installations\\ruby\\lib\\ruby\\gems\\1.8\\gems\\watir-
> > > 1.5.1.1145\\unittests\\jscriptExtraAlert.rb\"") }
> > > end
> > >
> > > # read file contents
> > > def read_js_popup_contents
> > > file = File.open("c:\\popup.txt")
> > > lines = file.readline
> > > while lines == ""
> > > lines = file.readline
> > > end
> > > lines = file.readlines
> > > file.close
> > > return lines
> > > end
> > >
> > >
> > > You need to modify WindowHelper.rb (in watir directory) class to
> > > enter text into the file before clicking OK button.
> > >
> > > 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
> > >
> > > Hope this helps
> > >
> > > - Angrez
> > > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > >
> > > > hi,
> > > > please some one reply..
> > > > its urgent..
> > > >
> > > > Regards
> > > > Shalini Gupta
> > > >
> > > > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > my code is as...
> > > > >
> > > > >
> > > > > requires
> > > > >
> > > > > require 'watir'
> > > > > #require 'autoit'
> > > > >
> > > > > require 'test/unit'
> > > > > require 'test/unit/ui/console/testrunner'
> > > > > require 'test/unit/assertions'
> > > > > #require 'watir/setFileDialog'
> > > > > #require 'popups_test'
> > > > > #require 'enabled_popup'
> > > > >
> > > > >
> > > > > #logger requires
> > > > > require 'example_logger1'
> > > > > require 'workbookfunction'
> > > > >
> > > > > #java_pophadler requires
> > > > > require 'WindowHelper'
> > > > > require 'win32ole'
> > > > > #require 'javapopup'
> > > > > #require 'winClickers'
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > includes
> > > > > include Watir
> > > > >
> > > > >
> > > > > class TC_PSC_userlogin < Test::Unit::TestCase
> > > > >
> > > > >   def startClicker( button , waitTime = 3)
> > > > > w = WinClicker.new
> > > > > longName = $ie.dir.gsub("/" , "\\" )
> > > > > shortName = w.getShortFileName(longName)
> > > > >
> > > > > c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
> > > > > #{waitTime} "
> > > > > puts "Starting #{c}"
> > > > > w.winsystem(c)
> > > > > w=nil
> > > > > ###end of function StartClicker
> > > > > end
> > > > >
> > > > >   def text(wait_seconds = 2)
> > > > >  sleep 0.3
> > > > > autoit = WIN32OLE.new("AutoItX3.Control ")
> > > > > autoit.WinWait("Microsoft Internet Explorer", nil,
> > > > > wait_seconds) if wait_seconds
> > > > > s = autoit.WinGetText("Microsoft Internet Explorer")
> > > > > file = File.open ("c:\\test.txt", "w")   #
> > > > > DONT MAKE YOUR VARIABLES GLOBAL UNNECESSARILY
> > > > > file.puts(s.to_s)
> > > > > puts s
> > > > > file.close
> > > > > #s unless s == "1"# NOT SURE WHY YOU ARE
> > > > > DOING THI

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

hi,
thanks!!

i have just started using watir.I am very new to it.
should i install autoit seperately...i think it is installed automatically
with watir.or ru talking about autoit tool..

Regards
Shalini

On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote:


Hi,

Simply saying its not working won't be of any help :). Did you get any
errors, exceptions? Make sure that IE is in focus when you use the code. Is
autoit installed properly? Same code works fine for me. I am able to get the
text of Javascript pop up.

Regards,
Angrez

On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:
>
> HI,
> Sorry..its also not working.
> i have done all the things told by u..
> but i think push_alert_button doesnt work.
>
> as i was using wincliker class to handle popup..
> that time popup was handled properly
>
> but now its not working..
>
> my previous startClicker method is:-
> def startClicker( button , waitTime = 3)
> w = WinClicker.new
> longName = $ie.dir.gsub("/" , "\\" )
> shortName = w.getShortFileName (longName)
>
> c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
> #{waitTime} "
> puts "Starting #{c}"
> w.winsystem(c)
> w=nil
> #nd of function StartClicker
> end
>
> Regards
> shalini gupta
>
> On 4/26/07, Angrez Singh < [EMAIL PROTECTED]> wrote:
> >
> > hi,
> >
> > this is simplest code that you can have:
> >
> > start_jsalert_clicker
> > $ie.button(:name,[some_name]).click
> > read_js_popup_contents
> >
> > # This only clicks ok button. Change teh path accordingly.
> > def start_jsalert_clicker
> > Thread.new{ system("rubyw
> > \"d:\\installations\\ruby\\lib\\ruby\\gems\\1.8\\gems\\watir-
> > 1.5.1.1145\\unittests\\jscriptExtraAlert.rb\"") }
> > end
> >
> > # read file contents
> > def read_js_popup_contents
> > file = File.open("c:\\popup.txt")
> > lines = file.readline
> > while lines == ""
> > lines = file.readline
> > end
> > lines = file.readlines
> > file.close
> > return lines
> > end
> >
> >
> > You need to modify WindowHelper.rb (in watir directory) class to enter
> > text into the file before clicking OK button.
> >
> > 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
> >
> > Hope this helps
> >
> > - Angrez
> > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> >
> > > hi,
> > > please some one reply..
> > > its urgent..
> > >
> > > Regards
> > > Shalini Gupta
> > >
> > > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > > >
> > > > Hi,
> > > >
> > > > my code is as...
> > > >
> > > >
> > > > requires
> > > >
> > > > require 'watir'
> > > > #require 'autoit'
> > > >
> > > > require 'test/unit'
> > > > require 'test/unit/ui/console/testrunner'
> > > > require 'test/unit/assertions'
> > > > #require 'watir/setFileDialog'
> > > > #require 'popups_test'
> > > > #require 'enabled_popup'
> > > >
> > > >
> > > > #logger requires
> > > > require 'example_logger1'
> > > > require 'workbookfunction'
> > > >
> > > > #java_pophadler requires
> > > > require 'WindowHelper'
> > > > require 'win32ole'
> > > > #require 'javapopup'
> > > > #require 'winClickers'
> > > >
> > > >
> > > >
> > > >
> > > > includes
> > > > include Watir
> > > >
> > > >
> > > > class TC_PSC_userlogin < Test::Unit::TestCase
> > > >
> > > >   def startClicker( button , waitTime = 3)
> > > > w = WinClicker.new
> > > > longName = $ie.dir.gsub("/" , "\\" )
> > > > shortName = w.getShortFileName(longName)
> > > >
> > > > c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
> > > > #{waitTime} "
> > > > puts "Starting #{c}"
> > > > w.winsystem(c)
> > > > w=nil
> > > > ###end of function StartClicker
> > > > end
> > > >
> > > >   def text(wait_seconds = 2)
> > > >  sleep 0.3
> > > > autoit = WIN32OLE.new("AutoItX3.Control ")
> > > > autoit.WinWait("Microsoft Internet Explorer", nil,
> > > > wait_seconds) if wait_seconds
> > > > s = autoit.WinGetText("Microsoft Internet Explorer")
> > > > file = File.open ("c:\\test.txt", "w")   #
> > > > DONT MAKE YOUR VARIABLES GLOBAL UNNECESSARILY
> > > > file.puts(s.to_s)
> > > > puts s
> > > > file.close
> > > > #s unless s == "1"# NOT SURE WHY YOU ARE
> > > > DOING THIS
> > > > end
> > > >
> > > >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")
> > > >
> > > >  

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread Angrez Singh

Hi,

Simply saying its not working won't be of any help :). Did you get any
errors, exceptions? Make sure that IE is in focus when you use the code. Is
autoit installed properly? Same code works fine for me. I am able to get the
text of Javascript pop up.

Regards,
Angrez

On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


HI,
Sorry..its also not working.
i have done all the things told by u..
but i think push_alert_button doesnt work.

as i was using wincliker class to handle popup..
that time popup was handled properly

but now its not working..

my previous startClicker method is:-
def startClicker( button , waitTime = 3)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName (longName)

c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
#{waitTime} "
puts "Starting #{c}"
w.winsystem(c)
w=nil
#nd of function StartClicker
end

Regards
shalini gupta

On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> this is simplest code that you can have:
>
> start_jsalert_clicker
> $ie.button(:name,[some_name]).click
> read_js_popup_contents
>
> # This only clicks ok button. Change teh path accordingly.
> def start_jsalert_clicker
> Thread.new{ system("rubyw
> \"d:\\installations\\ruby\\lib\\ruby\\gems\\1.8\\gems\\watir-
> 1.5.1.1145\\unittests\\jscriptExtraAlert.rb\"") }
> end
>
> # read file contents
> def read_js_popup_contents
> file = File.open("c:\\popup.txt")
> lines = file.readline
> while lines == ""
> lines = file.readline
> end
> lines = file.readlines
> file.close
> return lines
> end
>
>
> You need to modify WindowHelper.rb (in watir directory) class to enter
> text into the file before clicking OK button.
>
> 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
>
> Hope this helps
>
> - Angrez
> On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
>
> > hi,
> > please some one reply..
> > its urgent..
> >
> > Regards
> > Shalini Gupta
> >
> > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > >
> > > my code is as...
> > >
> > >
> > > requires
> > >
> > > require 'watir'
> > > #require 'autoit'
> > >
> > > require 'test/unit'
> > > require 'test/unit/ui/console/testrunner'
> > > require 'test/unit/assertions'
> > > #require 'watir/setFileDialog'
> > > #require 'popups_test'
> > > #require 'enabled_popup'
> > >
> > >
> > > #logger requires
> > > require 'example_logger1'
> > > require 'workbookfunction'
> > >
> > > #java_pophadler requires
> > > require 'WindowHelper'
> > > require 'win32ole'
> > > #require 'javapopup'
> > > #require 'winClickers'
> > >
> > >
> > >
> > >
> > > includes
> > > include Watir
> > >
> > >
> > > class TC_PSC_userlogin < Test::Unit::TestCase
> > >
> > >   def startClicker( button , waitTime = 3)
> > > w = WinClicker.new
> > > longName = $ie.dir.gsub("/" , "\\" )
> > > shortName = w.getShortFileName(longName)
> > >
> > > c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
> > > #{waitTime} "
> > > puts "Starting #{c}"
> > > w.winsystem(c)
> > > w=nil
> > > ###end of function StartClicker
> > > end
> > >
> > >   def text(wait_seconds = 2)
> > >  sleep 0.3
> > > autoit = WIN32OLE.new("AutoItX3.Control ")
> > > autoit.WinWait("Microsoft Internet Explorer", nil,
> > > wait_seconds) if wait_seconds
> > > s = autoit.WinGetText("Microsoft Internet Explorer")
> > > file = File.open ("c:\\test.txt", "w")   # DONT
> > > MAKE YOUR VARIABLES GLOBAL UNNECESSARILY
> > > file.puts(s.to_s)
> > > puts s
> > > file.close
> > > #s unless s == "1"# NOT SURE WHY YOU ARE
> > > DOING THIS
> > > end
> > >
> > >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 

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

hi,
please help!!
its very urgent

Regards
Shalini Gupta

On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


HI,
Sorry..its also not working.
i have done all the things told by u..
but i think push_alert_button doesnt work.

as i was using wincliker class to handle popup..
that time popup was handled properly

but now its not working..

my previous startClicker method is:-
def startClicker( button , waitTime = 3)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName (longName)

c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
#{waitTime} "
puts "Starting #{c}"
w.winsystem(c)
w=nil
#nd of function StartClicker
end

Regards
shalini gupta

On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> this is simplest code that you can have:
>
> start_jsalert_clicker
> $ie.button(:name,[some_name]).click
> read_js_popup_contents
>
> # This only clicks ok button. Change teh path accordingly.
> def start_jsalert_clicker
> Thread.new{ system("rubyw
> \"d:\\installations\\ruby\\lib\\ruby\\gems\\1.8\\gems\\watir-
> 1.5.1.1145\\unittests\\jscriptExtraAlert.rb\"") }
> end
>
> # read file contents
> def read_js_popup_contents
> file = File.open("c:\\popup.txt")
> lines = file.readline
> while lines == ""
> lines = file.readline
> end
> lines = file.readlines
> file.close
> return lines
> end
>
>
> You need to modify WindowHelper.rb (in watir directory) class to enter
> text into the file before clicking OK button.
>
> 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
>
> Hope this helps
>
> - Angrez
> On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
>
> > hi,
> > please some one reply..
> > its urgent..
> >
> > Regards
> > Shalini Gupta
> >
> > On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > >
> > > my code is as...
> > >
> > >
> > > requires
> > >
> > > require 'watir'
> > > #require 'autoit'
> > >
> > > require 'test/unit'
> > > require 'test/unit/ui/console/testrunner'
> > > require 'test/unit/assertions'
> > > #require 'watir/setFileDialog'
> > > #require 'popups_test'
> > > #require 'enabled_popup'
> > >
> > >
> > > #logger requires
> > > require 'example_logger1'
> > > require 'workbookfunction'
> > >
> > > #java_pophadler requires
> > > require 'WindowHelper'
> > > require 'win32ole'
> > > #require 'javapopup'
> > > #require 'winClickers'
> > >
> > >
> > >
> > >
> > > includes
> > > include Watir
> > >
> > >
> > > class TC_PSC_userlogin < Test::Unit::TestCase
> > >
> > >   def startClicker( button , waitTime = 3)
> > > w = WinClicker.new
> > > longName = $ie.dir.gsub("/" , "\\" )
> > > shortName = w.getShortFileName(longName)
> > >
> > > c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
> > > #{waitTime} "
> > > puts "Starting #{c}"
> > > w.winsystem(c)
> > > w=nil
> > > ###end of function StartClicker
> > > end
> > >
> > >   def text(wait_seconds = 2)
> > >  sleep 0.3
> > > autoit = WIN32OLE.new("AutoItX3.Control ")
> > > autoit.WinWait("Microsoft Internet Explorer", nil,
> > > wait_seconds) if wait_seconds
> > > s = autoit.WinGetText("Microsoft Internet Explorer")
> > > file = File.open ("c:\\test.txt", "w")   # DONT
> > > MAKE YOUR VARIABLES GLOBAL UNNECESSARILY
> > > file.puts(s.to_s)
> > > puts s
> > > file.close
> > > #s unless s == "1"# NOT SURE WHY YOU ARE
> > > DOING THIS
> > > end
> > >
> > >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

Re: [Wtr-general] how to capture text from popup window

2007-04-26 Thread SHALINI GUPTA

HI,
Sorry..its also not working.
i have done all the things told by u..
but i think push_alert_button doesnt work.

as i was using wincliker class to handle popup..
that time popup was handled properly

but now its not working..

my previous startClicker method is:-
def startClicker( button , waitTime = 3)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)

c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button} #{waitTime}
"
puts "Starting #{c}"
w.winsystem(c)
w=nil
#nd of function StartClicker
end

Regards
shalini gupta

On 4/26/07, Angrez Singh <[EMAIL PROTECTED]> wrote:


hi,

this is simplest code that you can have:

start_jsalert_clicker
$ie.button(:name,[some_name]).click
read_js_popup_contents

# This only clicks ok button. Change teh path accordingly.
def start_jsalert_clicker
Thread.new{ system("rubyw
\"d:\\installations\\ruby\\lib\\ruby\\gems\\1.8\\gems\\watir-
1.5.1.1145\\unittests\\jscriptExtraAlert.rb\"") }
end

# read file contents
def read_js_popup_contents
file = File.open("c:\\popup.txt")
lines = file.readline
while lines == ""
lines = file.readline
end
lines = file.readlines
file.close
return lines
end


You need to modify WindowHelper.rb (in watir directory) class to enter
text into the file before clicking OK button.

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

Hope this helps

- Angrez
On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:

> hi,
> please some one reply..
> its urgent..
>
> Regards
> Shalini Gupta
>
> On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > my code is as...
> >
> >
> > requires
> >
> > require 'watir'
> > #require 'autoit'
> >
> > require 'test/unit'
> > require 'test/unit/ui/console/testrunner'
> > require 'test/unit/assertions'
> > #require 'watir/setFileDialog'
> > #require 'popups_test'
> > #require 'enabled_popup'
> >
> >
> > #logger requires
> > require 'example_logger1'
> > require 'workbookfunction'
> >
> > #java_pophadler requires
> > require 'WindowHelper'
> > require 'win32ole'
> > #require 'javapopup'
> > #require 'winClickers'
> >
> >
> >
> >
> > includes
> > include Watir
> >
> >
> > class TC_PSC_userlogin < Test::Unit::TestCase
> >
> >   def startClicker( button , waitTime = 3)
> > w = WinClicker.new
> > longName = $ie.dir.gsub("/" , "\\" )
> > shortName = w.getShortFileName(longName)
> >
> > c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
> > #{waitTime} "
> > puts "Starting #{c}"
> > w.winsystem(c)
> > w=nil
> > ###end of function StartClicker
> > end
> >
> >   def text(wait_seconds = 2)
> >  sleep 0.3
> > autoit = WIN32OLE.new("AutoItX3.Control ")
> > autoit.WinWait("Microsoft Internet Explorer", nil,
> > wait_seconds) if wait_seconds
> > s = autoit.WinGetText("Microsoft Internet Explorer")
> > file = File.open ("c:\\test.txt", "w")   # DONT
> > MAKE YOUR VARIABLES GLOBAL UNNECESSARILY
> > file.puts(s.to_s)
> > puts s
> > file.close
> > #s unless s == "1"# NOT SURE WHY YOU ARE DOING
> > THIS
> > end
> >
> >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 :- 
'https://www.philipnow.com/envcss/'
> > ")
> >$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 

Re: [Wtr-general] how to capture text from popup window

2007-04-25 Thread Angrez Singh

hi,

this is simplest code that you can have:

start_jsalert_clicker
$ie.button(:name,[some_name]).click
read_js_popup_contents

# This only clicks ok button. Change teh path accordingly.
def start_jsalert_clicker
   Thread.new{ system("rubyw
\"d:\\installations\\ruby\\lib\\ruby\\gems\\1.8\\gems\\watir-
1.5.1.1145\\unittests\\jscriptExtraAlert.rb\"") }
end

# read file contents
def read_js_popup_contents
   file = File.open("c:\\popup.txt")
   lines = file.readline
   while lines == ""
   lines = file.readline
   end
   lines = file.readlines
   file.close
   return lines
end


You need to modify WindowHelper.rb (in watir directory) class to enter text
into the file before clicking OK button.

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

Hope this helps

- Angrez
On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


hi,
please some one reply..
its urgent..

Regards
Shalini Gupta

On 4/26/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
>
> Hi,
>
> my code is as...
>
>
> requires
>
> require 'watir'
> #require 'autoit'
>
> require 'test/unit'
> require 'test/unit/ui/console/testrunner'
> require 'test/unit/assertions'
> #require 'watir/setFileDialog'
> #require 'popups_test'
> #require 'enabled_popup'
>
>
> #logger requires
> require 'example_logger1'
> require 'workbookfunction'
>
> #java_pophadler requires
> require 'WindowHelper'
> require 'win32ole'
> #require 'javapopup'
> #require 'winClickers'
>
>
>
>
> includes
> include Watir
>
>
> class TC_PSC_userlogin < Test::Unit::TestCase
>
>   def startClicker( button , waitTime = 3)
> w = WinClicker.new
> longName = $ie.dir.gsub("/" , "\\" )
> shortName = w.getShortFileName(longName)
>
> c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
> #{waitTime} "
> puts "Starting #{c}"
> w.winsystem(c)
> w=nil
> ###end of function StartClicker
> end
>
>   def text(wait_seconds = 2)
>  sleep 0.3
> autoit = WIN32OLE.new("AutoItX3.Control ")
> autoit.WinWait("Microsoft Internet Explorer", nil,
> wait_seconds) if wait_seconds
> s = autoit.WinGetText("Microsoft Internet Explorer")
> file = File.open ("c:\\test.txt", "w")   # DONT MAKE
> YOUR VARIABLES GLOBAL UNNECESSARILY
> file.puts(s.to_s)
> puts s
> file.close
> #s unless s == "1"# NOT SURE WHY YOU ARE DOING
> THIS
> end
>
>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 :- 
'https://www.philipnow.com/envcss/'
> ")
>$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")
>
>
> =begin oPopup  = Watir::autoit
> # Change into the WinTitleMatchMode that supports classnames
> and handles
> oPopup.AutoItSetOption("WinTitleMatchMode", 4)
> 0.upto (timeout) { |i|}
> ret = oPopup.WinWait("Microsoft Internet Explorer","",1)
> win_text = oPopup.WinGetText("Microsoft Internet
> Explorer")
> if 1 == ret && !(win_text == '') then
> bPopupFound = true
> oPopup.WinActivate("Microsoft Internet Explorer",'')
> win_text  = oPopup.ControlGetText(what, '',
> 'Sta

Re: [Wtr-general] how to capture text from popup window

2007-04-25 Thread SHALINI GUPTA

hi,
please some one reply..
its urgent..

Regards
Shalini Gupta

On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


Hi,

my code is as...


requires

require 'watir'
#require 'autoit'

require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'test/unit/assertions'
#require 'watir/setFileDialog'
#require 'popups_test'
#require 'enabled_popup'


#logger requires
require 'example_logger1'
require 'workbookfunction'

#java_pophadler requires
require 'WindowHelper'
require 'win32ole'
#require 'javapopup'
#require 'winClickers'




includes
include Watir


class TC_PSC_userlogin < Test::Unit::TestCase

  def startClicker( button , waitTime = 3)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)

c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
#{waitTime} "
puts "Starting #{c}"
w.winsystem(c)
w=nil
###end of function StartClicker
end

  def text(wait_seconds = 2)
 sleep 0.3
autoit = WIN32OLE.new("AutoItX3.Control ")
autoit.WinWait("Microsoft Internet Explorer", nil,
wait_seconds) if wait_seconds
s = autoit.WinGetText("Microsoft Internet Explorer")
file = File.open ("c:\\test.txt", "w")   # DONT MAKE
YOUR VARIABLES GLOBAL UNNECESSARILY
file.puts(s.to_s)
puts s
file.close
#s unless s == "1"# NOT SURE WHY YOU ARE DOING
THIS
end

   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 :- 
'https://www.philipnow.com/envcss/'
")
   $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")


=begin oPopup  = Watir::autoit
# Change into the WinTitleMatchMode that supports classnames
and handles
oPopup.AutoItSetOption("WinTitleMatchMode", 4)
0.upto (timeout) { |i|}
ret = oPopup.WinWait("Microsoft Internet Explorer","",1)
win_text = oPopup.WinGetText("Microsoft Internet
Explorer")
if 1 == ret && !(win_text == '') then
bPopupFound = true
oPopup.WinActivate("Microsoft Internet Explorer",'')
win_text  = oPopup.ControlGetText(what, '',
'Static2').strip
if '' == win_text then win_text  =
oPopup.ControlGetText(what, '', 'Static1').strip end
break
=end

   startClicker("OK",3)

   #require 'js_dialog'
   #assert_js_dialog do

 $ie.button(:name, "login").click
 text(2)

  #end



   $logger.log(":Step-4: Click the Login button")


   $logger.log("Action-4: clicked the Login button.")


   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 cor

[Wtr-general] how to capture text from popup window

2007-04-25 Thread SHALINI GUPTA

Hi,

my code is as...


requires

require 'watir'
#require 'autoit'

require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'test/unit/assertions'
#require 'watir/setFileDialog'
#require 'popups_test'
#require 'enabled_popup'


#logger requires
require 'example_logger1'
require 'workbookfunction'

#java_pophadler requires
require 'WindowHelper'
require 'win32ole'
#require 'javapopup'
#require 'winClickers'




includes
include Watir


class TC_PSC_userlogin < Test::Unit::TestCase

 def startClicker( button , waitTime = 3)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)

c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button} #{waitTime}
"
puts "Starting #{c}"
w.winsystem(c)
w=nil
###end of function StartClicker
end

 def text(wait_seconds = 2)
sleep 0.3
   autoit = WIN32OLE.new("AutoItX3.Control")
   autoit.WinWait("Microsoft Internet Explorer", nil, wait_seconds)
if wait_seconds
   s = autoit.WinGetText("Microsoft Internet Explorer")
   file = File.open("c:\\test.txt", "w")   # DONT MAKE YOUR
VARIABLES GLOBAL UNNECESSARILY
   file.puts(s.to_s)
   puts s
   file.close
   #s unless s == "1"# NOT SURE WHY YOU ARE DOING THIS
end

  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 :- '
https://www.philipnow.com/envcss/'")
  $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")


=begin oPopup  = Watir::autoit
   # Change into the WinTitleMatchMode that supports classnames and
handles
   oPopup.AutoItSetOption("WinTitleMatchMode", 4)
   0.upto(timeout) { |i|}
   ret = oPopup.WinWait("Microsoft Internet Explorer","",1)
   win_text = oPopup.WinGetText("Microsoft Internet Explorer")
   if 1 == ret && !(win_text == '') then
   bPopupFound = true
   oPopup.WinActivate("Microsoft Internet Explorer",'')
   win_text  = oPopup.ControlGetText(what, '',
'Static2').strip
   if '' == win_text then win_text  =
oPopup.ControlGetText(what,
'', 'Static1').strip end
   break
=end

  startClicker("OK",3)

  #require 'js_dialog'
  #assert_js_dialog do

$ie.button(:name, "login").click
text(2)

 #end



  $logger.log(":Step-4: Click the Login button")


  $logger.log("Action-4: clicked the Login button.")


  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
_

Re: [Wtr-general] how to capture text from popup window

2007-04-25 Thread Angrez Singh

Hi Shalini,

Can you post the entire code? How you are calling this text function? How
you are handling the pop up?

- Angrez

On 4/26/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


hi Prema,

Sorry it not working..
It is printing 1 in text file.
please help!!

Regards
Shalini Gupta

On 4/25/07, Prema Arya < [EMAIL PROTECTED]> wrote:
>
> Hi Shalini,
>
> Just try this code (modified your code a little)
> def text(wait_seconds = 1)
> # sleep 0.3
> autoit = WIN32OLE.new("AutoItX3.Control")
> autoit.WinWait("Microsoft Internet Explorer", nil,
> wait_seconds) if wait_seconds
> s = autoit.WinGetText("Microsoft Internet Explorer")
> file = File.open("c:\\test.txt", "w")   # DONT MAKE
> YOUR VARIABLES GLOBAL UNNECESSARILY
> file.puts(s)
> file.close
> s unless s == "1"# NOT SURE WHY YOU ARE DOING
> THIS
> end
> Let me know if this works.
>
> Regards,
> Prema
>
> On 4/25/07, SHALINI GUPTA <[EMAIL PROTECTED] > wrote:
> >
> > hi,
> >
> > i have tried to write this as
> >
> > def text(wait_seconds = 1)
> > # sleep 0.3
> > autoit = WIN32OLE.new("AutoItX3.Control")
> > autoit.WinWait("Microsoft Internet Explorer", nil,
> > wait_seconds) if wait_seconds
> > s = autoit.WinGetText ("Microsoft Internet Explorer")
> > $File = File.open("c:\\test.txt", "w")
> > $File.puts(s.to_s)
> > s unless s == "1"
> > end
> >
> > but it is printing only 1..in the file.
> > please help.
> >
> > shalini gupta
> >
> > On 4/25/07, SHALINI GUPTA < [EMAIL PROTECTED] > wrote:
> > >
> > > hi,
> > > Thanks for quick reply...
> > >
> > > please tell me how can i write output of one method to a file
> > >
> > > my method is..
> > > def text(wait_seconds = 1)
> > > # sleep 0.3
> > > autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
> > > wait_seconds
> > > s = autoit.WinGetText(WINDOW_TITLE)
> > > s unless s == "1"
> > > end
> > > please help me..
> > >
> > > Thanks In Advance
> > > Regards
> > > Shalini Gupta
> > >
> > > On 4/25/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Hi,
> > > > As Paul said that you need to store the text in a file and then
> > > > read that file in your main process. Because pop up's are handled in
> > > > different process. So even if you return that value from the method it 
won't
> > > > be visible to main process. Write this value to a file and then read the
> > > > contents.
> > > >
> > > > Regards,
> > > > Angrez
> > > >
> > > > On 4/25/07, SHALINI GUPTA < [EMAIL PROTECTED] > wrote:
> > > > >
> > > > > hi,
> > > > >
> > > > > thanks for reply!!!
> > > > >
> > > > > but i have used autoit and WinGet Text as:---(with no success)
> > > > >
> > > > >  #- js_dialog.rb -
> > > > >
> > > > > require 'win32ole'
> > > > > require 'test/unit'
> > > > > require 'test/unit/ui/console/testrunner'
> > > > > #
> > > > > # Use AutoIt to read and close Javascript dialog windows
> > > > > #
> > > > > module JavascriptDialog
> > > > >
> > > > > #
> > > > > # Target javascript dialogs with this window title
> > > > > #
> > > > > WINDOW_TITLE = "Microsoft Internet Explorer"
> > > > >
> > > > > class << self
> > > > >
> > > > > #
> > > > > # Return the text contained in a javascript dialog (e.g.
> > > > > an "alert()")
> > > > > # if such a dialog is present or appears within
> > > > > +wait_seconds+.
> > > > > #
> > > > > def text(wait_seconds = 1)
> > > > > # sleep 0.3
> > > > > autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
> > > > > wait_seconds
> > > > > s = autoit.WinGetText(WINDOW_TITLE)
> > > > > s unless s == "1"
> > > > > end
> > > > >
> > > > > #
> > > > > # Close any active javascript dialog
> > > > > #
> > > > > def close
> > > > > autoit.WinClose WINDOW_TITLE
> > > > > end
> > > > >
> > > > > #
> > > > > # Press the "OK" button on a javascript dialog
> > > > > #
> > > > > def ok
> > > > > autoit.ControlClick(WINDOW_TITLE, "", "OK")
> > > > > end
> > > > > #
> > > > > # Press the "Cancel" button on a javascript dialog
> > > > > #
> > > > > def cancel
> > > > > autoit.ControlClick (WINDOW_TITLE, "", "Cancel")
> > > > > end
> > > > > #
> > > > > # Press the "Yes" button on a javascript dialog
> > > > > #
> > > > > def yes
> > > > > autoit.ControlClick(WINDOW_TITLE, "", "Yes")
> > > > > end
> > > > > #
> > > > > # Press the "No" button on a javascript dialog
> > > > > #
> > > > > def no
> > > > > autoit.ControlClick(WINDOW_TITLE, "", "No")
> > > > > end
> > > > >
> > > >

Re: [Wtr-general] how to capture text from popup window

2007-04-25 Thread SHALINI GUPTA

hi Prema,

Sorry it not working..
It is printing 1 in text file.
please help!!

Regards
Shalini Gupta

On 4/25/07, Prema Arya <[EMAIL PROTECTED]> wrote:


Hi Shalini,

Just try this code (modified your code a little)
def text(wait_seconds = 1)
# sleep 0.3
autoit = WIN32OLE.new("AutoItX3.Control")
autoit.WinWait("Microsoft Internet Explorer", nil,
wait_seconds) if wait_seconds
s = autoit.WinGetText("Microsoft Internet Explorer")
file = File.open("c:\\test.txt", "w")   # DONT MAKE
YOUR VARIABLES GLOBAL UNNECESSARILY
file.puts(s)
file.close
s unless s == "1"# NOT SURE WHY YOU ARE DOING THIS
end
Let me know if this works.

Regards,
Prema

On 4/25/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> i have tried to write this as
>
> def text(wait_seconds = 1)
> # sleep 0.3
> autoit = WIN32OLE.new("AutoItX3.Control")
> autoit.WinWait("Microsoft Internet Explorer", nil,
> wait_seconds) if wait_seconds
> s = autoit.WinGetText ("Microsoft Internet Explorer")
> $File = File.open("c:\\test.txt", "w")
> $File.puts(s.to_s)
> s unless s == "1"
> end
>
> but it is printing only 1..in the file.
> please help.
>
> shalini gupta
>
> On 4/25/07, SHALINI GUPTA < [EMAIL PROTECTED] > wrote:
> >
> > hi,
> > Thanks for quick reply...
> >
> > please tell me how can i write output of one method to a file
> >
> > my method is..
> > def text(wait_seconds = 1)
> > # sleep 0.3
> > autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
> > wait_seconds
> > s = autoit.WinGetText(WINDOW_TITLE)
> > s unless s == "1"
> > end
> > please help me..
> >
> > Thanks In Advance
> > Regards
> > Shalini Gupta
> >
> > On 4/25/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > > As Paul said that you need to store the text in a file and then read
> > > that file in your main process. Because pop up's are handled in different
> > > process. So even if you return that value from the method it won't be
> > > visible to main process. Write this value to a file and then read the
> > > contents.
> > >
> > > Regards,
> > > Angrez
> > >
> > > On 4/25/07, SHALINI GUPTA < [EMAIL PROTECTED] > wrote:
> > > >
> > > > hi,
> > > >
> > > > thanks for reply!!!
> > > >
> > > > but i have used autoit and WinGet Text as:---(with no success)
> > > >
> > > >  #- js_dialog.rb -
> > > >
> > > > require 'win32ole'
> > > > require 'test/unit'
> > > > require 'test/unit/ui/console/testrunner'
> > > > #
> > > > # Use AutoIt to read and close Javascript dialog windows
> > > > #
> > > > module JavascriptDialog
> > > >
> > > > #
> > > > # Target javascript dialogs with this window title
> > > > #
> > > > WINDOW_TITLE = "Microsoft Internet Explorer"
> > > >
> > > > class << self
> > > >
> > > > #
> > > > # Return the text contained in a javascript dialog (e.g.
> > > > an "alert()")
> > > > # if such a dialog is present or appears within
> > > > +wait_seconds+.
> > > > #
> > > > def text(wait_seconds = 1)
> > > > # sleep 0.3
> > > > autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
> > > > wait_seconds
> > > > s = autoit.WinGetText(WINDOW_TITLE)
> > > > s unless s == "1"
> > > > end
> > > >
> > > > #
> > > > # Close any active javascript dialog
> > > > #
> > > > def close
> > > > autoit.WinClose WINDOW_TITLE
> > > > end
> > > >
> > > > #
> > > > # Press the "OK" button on a javascript dialog
> > > > #
> > > > def ok
> > > > autoit.ControlClick(WINDOW_TITLE, "", "OK")
> > > > end
> > > > #
> > > > # Press the "Cancel" button on a javascript dialog
> > > > #
> > > > def cancel
> > > > autoit.ControlClick (WINDOW_TITLE, "", "Cancel")
> > > > end
> > > > #
> > > > # Press the "Yes" button on a javascript dialog
> > > > #
> > > > def yes
> > > > autoit.ControlClick(WINDOW_TITLE, "", "Yes")
> > > > end
> > > > #
> > > > # Press the "No" button on a javascript dialog
> > > > #
> > > > def no
> > > > autoit.ControlClick(WINDOW_TITLE, "", "No")
> > > > end
> > > >
> > > > private
> > > >
> > > > #
> > > > # Return an AutoIt COM object, creating it if it
> > > > doesn't already
> > > > # exist
> > > > #
> > > > def autoit
> > > > unless defined? @@autoit
> > > > @@autoit = WIN32OLE.new("AutoItX3.Control")
> > > > end
> > > > @@autoit
> > > > end
> > > > end
> > > > end
> > > >
> > > > modul

Re: [Wtr-general] how to capture text from popup window

2007-04-25 Thread Prema Arya

Hi Shalini,

Just try this code (modified your code a little)
def text(wait_seconds = 1)
   # sleep 0.3
   autoit = WIN32OLE.new("AutoItX3.Control")
   autoit.WinWait("Microsoft Internet Explorer", nil, wait_seconds)
if wait_seconds
   s = autoit.WinGetText("Microsoft Internet Explorer")
   file = File.open("c:\\test.txt", "w")   # DONT MAKE
YOUR VARIABLES GLOBAL UNNECESSARILY
   file.puts(s)
   file.close
   s unless s == "1"# NOT SURE WHY YOU ARE DOING THIS
end
Let me know if this works.

Regards,
Prema

On 4/25/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


hi,

i have tried to write this as

def text(wait_seconds = 1)
# sleep 0.3
autoit = WIN32OLE.new("AutoItX3.Control")
autoit.WinWait("Microsoft Internet Explorer", nil,
wait_seconds) if wait_seconds
s = autoit.WinGetText("Microsoft Internet Explorer")
$File = File.open("c:\\test.txt", "w")
$File.puts(s.to_s)
s unless s == "1"
end

but it is printing only 1..in the file.
please help.

shalini gupta

On 4/25/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
>
> hi,
> Thanks for quick reply...
>
> please tell me how can i write output of one method to a file
>
> my method is..
> def text(wait_seconds = 1)
> # sleep 0.3
> autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
> wait_seconds
> s = autoit.WinGetText(WINDOW_TITLE)
> s unless s == "1"
> end
> please help me..
>
> Thanks In Advance
> Regards
> Shalini Gupta
>
> On 4/25/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> > As Paul said that you need to store the text in a file and then read
> > that file in your main process. Because pop up's are handled in different
> > process. So even if you return that value from the method it won't be
> > visible to main process. Write this value to a file and then read the
> > contents.
> >
> > Regards,
> > Angrez
> >
> > On 4/25/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> > >
> > > hi,
> > >
> > > thanks for reply!!!
> > >
> > > but i have used autoit and WinGet Text as:---(with no success)
> > >
> > >  #- js_dialog.rb -
> > >
> > > require 'win32ole'
> > > require 'test/unit'
> > > require 'test/unit/ui/console/testrunner'
> > > #
> > > # Use AutoIt to read and close Javascript dialog windows
> > > #
> > > module JavascriptDialog
> > >
> > > #
> > > # Target javascript dialogs with this window title
> > > #
> > > WINDOW_TITLE = "Microsoft Internet Explorer"
> > >
> > > class << self
> > >
> > > #
> > > # Return the text contained in a javascript dialog (e.g. an
> > > "alert()")
> > > # if such a dialog is present or appears within
> > > +wait_seconds+.
> > > #
> > > def text(wait_seconds = 1)
> > > # sleep 0.3
> > > autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
> > > wait_seconds
> > > s = autoit.WinGetText(WINDOW_TITLE)
> > > s unless s == "1"
> > > end
> > >
> > > #
> > > # Close any active javascript dialog
> > > #
> > > def close
> > > autoit.WinClose WINDOW_TITLE
> > > end
> > >
> > > #
> > > # Press the "OK" button on a javascript dialog
> > > #
> > > def ok
> > > autoit.ControlClick(WINDOW_TITLE, "", "OK")
> > > end
> > > #
> > > # Press the "Cancel" button on a javascript dialog
> > > #
> > > def cancel
> > > autoit.ControlClick(WINDOW_TITLE, "", "Cancel")
> > > end
> > > #
> > > # Press the "Yes" button on a javascript dialog
> > > #
> > > def yes
> > > autoit.ControlClick(WINDOW_TITLE, "", "Yes")
> > > end
> > > #
> > > # Press the "No" button on a javascript dialog
> > > #
> > > def no
> > > autoit.ControlClick(WINDOW_TITLE, "", "No")
> > > end
> > >
> > > private
> > >
> > > #
> > > # Return an AutoIt COM object, creating it if it doesn't
> > > already
> > > # exist
> > > #
> > > def autoit
> > > unless defined? @@autoit
> > > @@autoit = WIN32OLE.new("AutoItX3.Control")
> > > end
> > > @@autoit
> > > end
> > > end
> > > end
> > >
> > > module Test::Unit::Assertions
> > > #
> > > # Passes if a Javascript dialog appears within +wait_seconds+
> > > and its
> > > # text matches the given (optional) pattern.
> > > #
> > > # Use like this:
> > > #  assert_js_dialog do
> > > #watir_command_to_make_dialog_appear
> > > #  end
> > > # Or like this:
> > > #  assert_js_dialog /Text to find in the dialog/, "Cancel" do
> > > #watir_command

Re: [Wtr-general] how to capture text from popup window

2007-04-25 Thread Prema Arya

Hi Shalini,

Just try this code (modified your code a little)
def text(wait_seconds = 1)
   # sleep 0.3
   autoit = WIN32OLE.new("AutoItX3.Control")
   autoit.WinWait("Microsoft Internet Explorer", nil, wait_seconds)
if wait_seconds
   s = autoit.WinGetText("Microsoft Internet Explorer")
   file = File.open("c:\\test.txt", "w")   # DONT MAKE
YOUR VARIABLES GLOBAL UNNECESSARILY
   file.puts(s)
   file.close
   s unless s == "1"# NOT SURE WHY YOU ARE DOING THIS
end
Let me know if this works.

Regards,
Prema

On 4/25/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


hi,

i have tried to write this as

def text(wait_seconds = 1)
# sleep 0.3
autoit = WIN32OLE.new("AutoItX3.Control")
autoit.WinWait("Microsoft Internet Explorer", nil,
wait_seconds) if wait_seconds
s = autoit.WinGetText ("Microsoft Internet Explorer")
$File = File.open("c:\\test.txt", "w")
$File.puts(s.to_s)
s unless s == "1"
end

but it is printing only 1..in the file.
please help.

shalini gupta

On 4/25/07, SHALINI GUPTA < [EMAIL PROTECTED] > wrote:
>
> hi,
> Thanks for quick reply...
>
> please tell me how can i write output of one method to a file
>
> my method is..
> def text(wait_seconds = 1)
> # sleep 0.3
> autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
> wait_seconds
> s = autoit.WinGetText(WINDOW_TITLE)
> s unless s == "1"
> end
> please help me..
>
> Thanks In Advance
> Regards
> Shalini Gupta
>
> On 4/25/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> > As Paul said that you need to store the text in a file and then read
> > that file in your main process. Because pop up's are handled in different
> > process. So even if you return that value from the method it won't be
> > visible to main process. Write this value to a file and then read the
> > contents.
> >
> > Regards,
> > Angrez
> >
> > On 4/25/07, SHALINI GUPTA < [EMAIL PROTECTED] > wrote:
> > >
> > > hi,
> > >
> > > thanks for reply!!!
> > >
> > > but i have used autoit and WinGet Text as:---(with no success)
> > >
> > >  #- js_dialog.rb -
> > >
> > > require 'win32ole'
> > > require 'test/unit'
> > > require 'test/unit/ui/console/testrunner'
> > > #
> > > # Use AutoIt to read and close Javascript dialog windows
> > > #
> > > module JavascriptDialog
> > >
> > > #
> > > # Target javascript dialogs with this window title
> > > #
> > > WINDOW_TITLE = "Microsoft Internet Explorer"
> > >
> > > class << self
> > >
> > > #
> > > # Return the text contained in a javascript dialog (e.g. an
> > > "alert()")
> > > # if such a dialog is present or appears within
> > > +wait_seconds+.
> > > #
> > > def text(wait_seconds = 1)
> > > # sleep 0.3
> > > autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
> > > wait_seconds
> > > s = autoit.WinGetText(WINDOW_TITLE)
> > > s unless s == "1"
> > > end
> > >
> > > #
> > > # Close any active javascript dialog
> > > #
> > > def close
> > > autoit.WinClose WINDOW_TITLE
> > > end
> > >
> > > #
> > > # Press the "OK" button on a javascript dialog
> > > #
> > > def ok
> > > autoit.ControlClick(WINDOW_TITLE, "", "OK")
> > > end
> > > #
> > > # Press the "Cancel" button on a javascript dialog
> > > #
> > > def cancel
> > > autoit.ControlClick (WINDOW_TITLE, "", "Cancel")
> > > end
> > > #
> > > # Press the "Yes" button on a javascript dialog
> > > #
> > > def yes
> > > autoit.ControlClick(WINDOW_TITLE, "", "Yes")
> > > end
> > > #
> > > # Press the "No" button on a javascript dialog
> > > #
> > > def no
> > > autoit.ControlClick(WINDOW_TITLE, "", "No")
> > > end
> > >
> > > private
> > >
> > > #
> > > # Return an AutoIt COM object, creating it if it doesn't
> > > already
> > > # exist
> > > #
> > > def autoit
> > > unless defined? @@autoit
> > > @@autoit = WIN32OLE.new("AutoItX3.Control")
> > > end
> > > @@autoit
> > > end
> > > end
> > > end
> > >
> > > module Test::Unit::Assertions
> > > #
> > > # Passes if a Javascript dialog appears within +wait_seconds+
> > > and its
> > > # text matches the given (optional) pattern.
> > > #
> > > # Use like this:
> > > #  assert_js_dialog do
> > > #watir_command_to_make_dialog_appear
> > > #  end
> > > # Or like this:
> > > #  assert_js_dialog /Text to find in the dialog/, "Cancel" do
> > > #watir_com

Re: [Wtr-general] how to capture text from popup window

2007-04-24 Thread SHALINI GUPTA

hi,

i have tried to write this as

def text(wait_seconds = 1)
   # sleep 0.3
   autoit = WIN32OLE.new("AutoItX3.Control")
   autoit.WinWait("Microsoft Internet Explorer", nil, wait_seconds)
if wait_seconds
   s = autoit.WinGetText("Microsoft Internet Explorer")
   $File = File.open("c:\\test.txt", "w")
   $File.puts(s.to_s)
   s unless s == "1"
   end

but it is printing only 1..in the file.
please help.

shalini gupta

On 4/25/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


hi,
Thanks for quick reply...

please tell me how can i write output of one method to a file

my method is..
def text(wait_seconds = 1)
# sleep 0.3
autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
wait_seconds
s = autoit.WinGetText(WINDOW_TITLE)
s unless s == "1"
end
please help me..

Thanks In Advance
Regards
Shalini Gupta

On 4/25/07, Angrez Singh <[EMAIL PROTECTED]> wrote:
>
> Hi,
> As Paul said that you need to store the text in a file and then read
> that file in your main process. Because pop up's are handled in different
> process. So even if you return that value from the method it won't be
> visible to main process. Write this value to a file and then read the
> contents.
>
> Regards,
> Angrez
>
> On 4/25/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> >
> > hi,
> >
> > thanks for reply!!!
> >
> > but i have used autoit and WinGet Text as:---(with no success)
> >
> >  #- js_dialog.rb -
> >
> > require 'win32ole'
> > require 'test/unit'
> > require 'test/unit/ui/console/testrunner'
> > #
> > # Use AutoIt to read and close Javascript dialog windows
> > #
> > module JavascriptDialog
> >
> > #
> > # Target javascript dialogs with this window title
> > #
> > WINDOW_TITLE = "Microsoft Internet Explorer"
> >
> > class << self
> >
> > #
> > # Return the text contained in a javascript dialog (e.g. an
> > "alert()")
> > # if such a dialog is present or appears within
> > +wait_seconds+.
> > #
> > def text(wait_seconds = 1)
> > # sleep 0.3
> > autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
> > wait_seconds
> > s = autoit.WinGetText(WINDOW_TITLE)
> > s unless s == "1"
> > end
> >
> > #
> > # Close any active javascript dialog
> > #
> > def close
> > autoit.WinClose WINDOW_TITLE
> > end
> >
> > #
> > # Press the "OK" button on a javascript dialog
> > #
> > def ok
> > autoit.ControlClick(WINDOW_TITLE, "", "OK")
> > end
> > #
> > # Press the "Cancel" button on a javascript dialog
> > #
> > def cancel
> > autoit.ControlClick(WINDOW_TITLE, "", "Cancel")
> > end
> > #
> > # Press the "Yes" button on a javascript dialog
> > #
> > def yes
> > autoit.ControlClick(WINDOW_TITLE, "", "Yes")
> > end
> > #
> > # Press the "No" button on a javascript dialog
> > #
> > def no
> > autoit.ControlClick(WINDOW_TITLE, "", "No")
> > end
> >
> > private
> >
> > #
> > # Return an AutoIt COM object, creating it if it doesn't
> > already
> > # exist
> > #
> > def autoit
> > unless defined? @@autoit
> > @@autoit = WIN32OLE.new("AutoItX3.Control")
> > end
> > @@autoit
> > end
> > end
> > end
> >
> > module Test::Unit::Assertions
> > #
> > # Passes if a Javascript dialog appears within +wait_seconds+ and
> > its
> > # text matches the given (optional) pattern.
> > #
> > # Use like this:
> > #  assert_js_dialog do
> > #watir_command_to_make_dialog_appear
> > #  end
> > # Or like this:
> > #  assert_js_dialog /Text to find in the dialog/, "Cancel" do
> > #watir_command_to_make_dialog_appear
> > #  end
> > #
> > def assert_js_dialog(pattern = //, action = "close", message =
> > nil)
> > _wrap_assertion do
> > begin
> > pipe = IO.popen("ruby exetry.rb #{action}")
> > yield
> > window_text = pipe.read rescue ""
> > pipe.close
> > unless window_text.empty?
> > assert_block(build_message(message,
> > " not found in JavaScript dialog.",
> > pattern)) do
> > window_text.match(pattern)
> > end
> > else
> > raise Test::Unit:: AssertionFailedError.new(
> > build_message(message, "No JavaScript window
> > found."))
> > end
> > ensure
> > pipe.close if pipe && !pipe.closed?
> > 

Re: [Wtr-general] how to capture text from popup window

2007-04-24 Thread SHALINI GUPTA

hi,
Thanks for quick reply...

please tell me how can i write output of one method to a file

my method is..
def text(wait_seconds = 1)
   # sleep 0.3
   autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if wait_seconds
   s = autoit.WinGetText(WINDOW_TITLE)
   s unless s == "1"
   end
please help me..

Thanks In Advance
Regards
Shalini Gupta

On 4/25/07, Angrez Singh <[EMAIL PROTECTED]> wrote:


Hi,
As Paul said that you need to store the text in a file and then read that
file in your main process. Because pop up's are handled in different
process. So even if you return that value from the method it won't be
visible to main process. Write this value to a file and then read the
contents.

Regards,
Angrez

On 4/25/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> thanks for reply!!!
>
> but i have used autoit and WinGet Text as:---(with no success)
>
>  #- js_dialog.rb -
>
> require 'win32ole'
> require 'test/unit'
> require 'test/unit/ui/console/testrunner'
> #
> # Use AutoIt to read and close Javascript dialog windows
> #
> module JavascriptDialog
>
> #
> # Target javascript dialogs with this window title
> #
> WINDOW_TITLE = "Microsoft Internet Explorer"
>
> class << self
>
> #
> # Return the text contained in a javascript dialog (e.g. an
> "alert()")
> # if such a dialog is present or appears within +wait_seconds+.
> #
> def text(wait_seconds = 1)
> # sleep 0.3
> autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
> wait_seconds
> s = autoit.WinGetText(WINDOW_TITLE)
> s unless s == "1"
> end
>
> #
> # Close any active javascript dialog
> #
> def close
> autoit.WinClose WINDOW_TITLE
> end
>
> #
> # Press the "OK" button on a javascript dialog
> #
> def ok
> autoit.ControlClick(WINDOW_TITLE, "", "OK")
> end
> #
> # Press the "Cancel" button on a javascript dialog
> #
> def cancel
> autoit.ControlClick(WINDOW_TITLE, "", "Cancel")
> end
> #
> # Press the "Yes" button on a javascript dialog
> #
> def yes
> autoit.ControlClick(WINDOW_TITLE, "", "Yes")
> end
> #
> # Press the "No" button on a javascript dialog
> #
> def no
> autoit.ControlClick(WINDOW_TITLE, "", "No")
> end
>
> private
>
> #
> # Return an AutoIt COM object, creating it if it doesn't
> already
> # exist
> #
> def autoit
> unless defined? @@autoit
> @@autoit = WIN32OLE.new("AutoItX3.Control")
> end
> @@autoit
> end
> end
> end
>
> module Test::Unit::Assertions
> #
> # Passes if a Javascript dialog appears within +wait_seconds+ and
> its
> # text matches the given (optional) pattern.
> #
> # Use like this:
> #  assert_js_dialog do
> #watir_command_to_make_dialog_appear
> #  end
> # Or like this:
> #  assert_js_dialog /Text to find in the dialog/, "Cancel" do
> #watir_command_to_make_dialog_appear
> #  end
> #
> def assert_js_dialog(pattern = //, action = "close", message = nil)
> _wrap_assertion do
> begin
> pipe = IO.popen("ruby exetry.rb #{action}")
> yield
> window_text = pipe.read rescue ""
> pipe.close
> unless window_text.empty?
> assert_block(build_message(message,
> " not found in JavaScript dialog.", pattern))
> do
> window_text.match(pattern)
> end
> else
> raise Test::Unit:: AssertionFailedError.new(
> build_message(message, "No JavaScript window
> found."))
> end
> ensure
> pipe.close if pipe && !pipe.closed?
> end
> end
> end
> end
>
> # test - will close and print the text of an opened javascript dialog if
> # run as "ruby js_dialog.rb"
> if $0 == __FILE__
> action = ARGV.shift || "close"
> print JavascriptDialog.text || ""
> JavascriptDialog.send action
> end
>
> if possible then please help me...and give me some code...
>
> Regards
> Shalini Gupta
>
>
> On 4/24/07, Paul Rogers < [EMAIL PROTECTED]> wrote:
> >
> > there is stuff in the winclicker to do it too. We've got the
> > javascript pop up text back to the main app by saving it to a file
> >
> > Paul
> >
> > Hi,
> >
> > As far as I know, clicking some button on Pop up window happens in a
> > different process (different from current process in which your script is
> > running). Correct me if I am wrong here?
> >
> > Yo

Re: [Wtr-general] how to capture text from popup window

2007-04-24 Thread Angrez Singh

Hi,
As Paul said that you need to store the text in a file and then read that
file in your main process. Because pop up's are handled in different
process. So even if you return that value from the method it won't be
visible to main process. Write this value to a file and then read the
contents.

Regards,
Angrez

On 4/25/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


hi,

thanks for reply!!!

but i have used autoit and WinGet Text as:---(with no success)

 #- js_dialog.rb -

require 'win32ole'
require 'test/unit'
require 'test/unit/ui/console/testrunner'
#
# Use AutoIt to read and close Javascript dialog windows
#
module JavascriptDialog

#
# Target javascript dialogs with this window title
#
WINDOW_TITLE = "Microsoft Internet Explorer"

class << self

#
# Return the text contained in a javascript dialog (e.g. an
"alert()")
# if such a dialog is present or appears within +wait_seconds+.
#
def text(wait_seconds = 1)
# sleep 0.3
autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if
wait_seconds
s = autoit.WinGetText(WINDOW_TITLE)
s unless s == "1"
end

#
# Close any active javascript dialog
#
def close
autoit.WinClose WINDOW_TITLE
end

#
# Press the "OK" button on a javascript dialog
#
def ok
autoit.ControlClick(WINDOW_TITLE, "", "OK")
end
#
# Press the "Cancel" button on a javascript dialog
#
def cancel
autoit.ControlClick(WINDOW_TITLE, "", "Cancel")
end
#
# Press the "Yes" button on a javascript dialog
#
def yes
autoit.ControlClick(WINDOW_TITLE, "", "Yes")
end
#
# Press the "No" button on a javascript dialog
#
def no
autoit.ControlClick(WINDOW_TITLE, "", "No")
end

private

#
# Return an AutoIt COM object, creating it if it doesn't
already
# exist
#
def autoit
unless defined? @@autoit
@@autoit = WIN32OLE.new("AutoItX3.Control")
end
@@autoit
end
end
end

module Test::Unit::Assertions
#
# Passes if a Javascript dialog appears within +wait_seconds+ and its
# text matches the given (optional) pattern.
#
# Use like this:
#  assert_js_dialog do
#watir_command_to_make_dialog_appear
#  end
# Or like this:
#  assert_js_dialog /Text to find in the dialog/, "Cancel" do
#watir_command_to_make_dialog_appear
#  end
#
def assert_js_dialog(pattern = //, action = "close", message = nil)
_wrap_assertion do
begin
pipe = IO.popen("ruby exetry.rb #{action}")
yield
window_text = pipe.read rescue ""
pipe.close
unless window_text.empty?
assert_block(build_message(message,
" not found in JavaScript dialog.", pattern))
do
window_text.match(pattern)
end
else
raise Test::Unit:: AssertionFailedError.new(
build_message(message, "No JavaScript window
found."))
end
ensure
pipe.close if pipe && !pipe.closed?
end
end
end
end

# test - will close and print the text of an opened javascript dialog if
# run as "ruby js_dialog.rb"
if $0 == __FILE__
action = ARGV.shift || "close"
print JavascriptDialog.text || ""
JavascriptDialog.send action
end

if possible then please help me...and give me some code...

Regards
Shalini Gupta


On 4/24/07, Paul Rogers <[EMAIL PROTECTED]> wrote:
>
> there is stuff in the winclicker to do it too. We've got the javascript
> pop up text back to the main app by saving it to a file
>
> Paul
>
> Hi,
>
> As far as I know, clicking some button on Pop up window happens in a
> different process (different from current process in which your script is
> running). Correct me if I am wrong here?
>
> You can get the text using AutoIt3 and WinGetText method. The only thing
> you need to find out is how you communicate data or the text between two
> different processes.
>
> Regards,
> Angrez
>
> On 4/24/07, SHALINI GUPTA < [EMAIL PROTECTED]> wrote:
> >
> > HI List,
> >
> > Please help regarding popup.
> > How to get the text of a popup window..
> > its very urgent please help.
> >
> > 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

Re: [Wtr-general] how to capture text from popup window

2007-04-24 Thread SHALINI GUPTA

hi,

thanks for reply!!!

but i have used autoit and WinGet Text as:---(with no success)

#- js_dialog.rb -

require 'win32ole'
require 'test/unit'
require 'test/unit/ui/console/testrunner'
#
# Use AutoIt to read and close Javascript dialog windows
#
module JavascriptDialog

   #
   # Target javascript dialogs with this window title
   #
   WINDOW_TITLE = "Microsoft Internet Explorer"

   class << self

   #
   # Return the text contained in a javascript dialog (e.g. an
"alert()")
   # if such a dialog is present or appears within +wait_seconds+.
   #
   def text(wait_seconds = 1)
   # sleep 0.3
   autoit.WinWait(WINDOW_TITLE, nil, wait_seconds) if wait_seconds
   s = autoit.WinGetText(WINDOW_TITLE)
   s unless s == "1"
   end

   #
   # Close any active javascript dialog
   #
   def close
   autoit.WinClose WINDOW_TITLE
   end

   #
   # Press the "OK" button on a javascript dialog
   #
   def ok
   autoit.ControlClick(WINDOW_TITLE, "", "OK")
   end
   #
   # Press the "Cancel" button on a javascript dialog
   #
   def cancel
   autoit.ControlClick(WINDOW_TITLE, "", "Cancel")
   end
   #
   # Press the "Yes" button on a javascript dialog
   #
   def yes
   autoit.ControlClick(WINDOW_TITLE, "", "Yes")
   end
   #
   # Press the "No" button on a javascript dialog
   #
   def no
   autoit.ControlClick(WINDOW_TITLE, "", "No")
   end

   private

   #
   # Return an AutoIt COM object, creating it if it doesn't already
   # exist
   #
   def autoit
   unless defined? @@autoit
   @@autoit = WIN32OLE.new("AutoItX3.Control")
   end
   @@autoit
   end
   end
end

module Test::Unit::Assertions
   #
   # Passes if a Javascript dialog appears within +wait_seconds+ and its
   # text matches the given (optional) pattern.
   #
   # Use like this:
   #  assert_js_dialog do
   #watir_command_to_make_dialog_appear
   #  end
   # Or like this:
   #  assert_js_dialog /Text to find in the dialog/, "Cancel" do
   #watir_command_to_make_dialog_appear
   #  end
   #
   def assert_js_dialog(pattern = //, action = "close", message = nil)
   _wrap_assertion do
   begin
   pipe = IO.popen("ruby exetry.rb #{action}")
   yield
   window_text = pipe.read rescue ""
   pipe.close
   unless window_text.empty?
   assert_block(build_message(message,
   " not found in JavaScript dialog.", pattern)) do
   window_text.match(pattern)
   end
   else
   raise Test::Unit::AssertionFailedError.new(
   build_message(message, "No JavaScript window
found."))
   end
   ensure
   pipe.close if pipe && !pipe.closed?
   end
   end
   end
end

# test - will close and print the text of an opened javascript dialog if
# run as "ruby js_dialog.rb"
if $0 == __FILE__
   action = ARGV.shift || "close"
   print JavascriptDialog.text || ""
   JavascriptDialog.send action
end

if possible then please help me...and give me some code...

Regards
Shalini Gupta


On 4/24/07, Paul Rogers <[EMAIL PROTECTED]> wrote:


there is stuff in the winclicker to do it too. We've got the javascript
pop up text back to the main app by saving it to a file

Paul

Hi,

As far as I know, clicking some button on Pop up window happens in a
different process (different from current process in which your script is
running). Correct me if I am wrong here?

You can get the text using AutoIt3 and WinGetText method. The only thing
you need to find out is how you communicate data or the text between two
different processes.

Regards,
Angrez

On 4/24/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:
>
> HI List,
>
> Please help regarding popup.
> How to get the text of a popup window..
> its very urgent please help.
>
> 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

Re: [Wtr-general] how to capture text from popup window

2007-04-24 Thread Paul Rogers
there is stuff in the winclicker to do it too. We've got the javascript pop up 
text back to the main app by saving it to a file

Paul

Hi,

As far as I know, clicking some button on Pop up window happens in a
different process (different from current process in which your script is
running). Correct me if I am wrong here?

You can get the text using AutoIt3 and WinGetText method. The only thing you
need to find out is how you communicate data or the text between two
different processes.

Regards,
Angrez

On 4/24/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


HI List,

Please help regarding popup.
How to get the text of a popup window..
its very urgent please help.

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

Re: [Wtr-general] how to capture text from popup window

2007-04-24 Thread Angrez Singh

Hi,

As far as I know, clicking some button on Pop up window happens in a
different process (different from current process in which your script is
running). Correct me if I am wrong here?

You can get the text using AutoIt3 and WinGetText method. The only thing you
need to find out is how you communicate data or the text between two
different processes.

Regards,
Angrez

On 4/24/07, SHALINI GUPTA <[EMAIL PROTECTED]> wrote:


HI List,

Please help regarding popup.
How to get the text of a popup window..
its very urgent please help.

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] how to capture text from popup window

2007-04-24 Thread SHALINI GUPTA

HI List,

Please help regarding popup.
How to get the text of a popup window..
its very urgent please help.

Regards
Shalini gupta
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general