Re: [wtr-general] Re: How to create a file and save it.

2010-06-03 Thread Wesley Chen
When you have installed Ruby, there is a man doc, I think for the newbie,
you can study a lot from it, and it is really basic but important.


Wesley.
For life, the easier, the better.


On Fri, Jun 4, 2010 at 2:01 AM, orde  wrote:

> The Ruby IO and File classes contain untold goodies.   I'd suggest
> reading up on them:
>
> http://www.ruby-doc.org/core/classes/File.html
> http://www.ruby-doc.org/core/classes/IO.html
>
> Hope it helps.
>
> orde
>
>
> On Jun 3, 7:49 am, Adam Reed  wrote:
> > With respect, file manipulation is a basic feature of Ruby.  WATIR is
> > a testing library/tool that makes use of the basic built-in Ruby
> > functionality.  That is the distinction that is being made.
> >
> > In your case, you would need to design a way to locate the Order Id,
> > temporarily assign that value to a variable, open or create a text
> > file, and finally write this value to the file.
> >
> > Which step in that process are you having difficulty coding?
> >
> > Thanks,
> > Adam
> >
> > On Jun 3, 9:17 am, meaculpa  wrote:
> >
> >
> >
> > > Its WATIR specific only. And This is not a blanket request for help.
> >
> > > Everyone in this forum are having experience and they are not just
> > > NOOBS. So they can surely understand what i mean... Also After
> > > googling only I post here...
> >
> > > I believe this group is mainly for helping each other than creating
> > > specific rules !!!
> >
> > > I accept that my question was little.
> >
> > > My actual problem is :
> >
> > > From a webpage I get a Order Id. I want to save that in a notepad. I
> > > googled and didnt find any help.
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> You received this message because you are subscribed to
> http://groups.google.com/group/watir-general
> To post: watir-general@googlegroups.com
> To unsubscribe: 
> watir-general+unsubscr...@googlegroups.com
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] get value from password type text-field

2010-06-03 Thread kashyap
Hi all,

I am testing(using Watir) a web-form that has many text fields in
it.One of the text-fields is a password type text field.

The text-field's HTML is:


The requirement is to check if the default password that is there on
the text-field is a valid password or not.
For this i need to get the value from that text-field.

I tried the follwowing:
passwordValue = $ie.text_field(:id, idPassword).value

However, passwordValue has a value 1 in it.It is not giving me the
exact value of the password.

Is there any other way to retrieve the value from a text-field that is
of type password?

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] getFocusedElement

2010-06-03 Thread kashyap
Hi all,

Is there a method in Watir to get the id/name of the current focused
element in a webpage?

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: How to create a file and save it.

2010-06-03 Thread orde
The Ruby IO and File classes contain untold goodies.   I'd suggest
reading up on them:

http://www.ruby-doc.org/core/classes/File.html
http://www.ruby-doc.org/core/classes/IO.html

Hope it helps.

orde


On Jun 3, 7:49 am, Adam Reed  wrote:
> With respect, file manipulation is a basic feature of Ruby.  WATIR is
> a testing library/tool that makes use of the basic built-in Ruby
> functionality.  That is the distinction that is being made.
>
> In your case, you would need to design a way to locate the Order Id,
> temporarily assign that value to a variable, open or create a text
> file, and finally write this value to the file.
>
> Which step in that process are you having difficulty coding?
>
> Thanks,
> Adam
>
> On Jun 3, 9:17 am, meaculpa  wrote:
>
>
>
> > Its WATIR specific only. And This is not a blanket request for help.
>
> > Everyone in this forum are having experience and they are not just
> > NOOBS. So they can surely understand what i mean... Also After
> > googling only I post here...
>
> > I believe this group is mainly for helping each other than creating
> > specific rules !!!
>
> > I accept that my question was little.
>
> > My actual problem is :
>
> > From a webpage I get a Order Id. I want to save that in a notepad. I
> > googled and didnt find any help.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: How to create a file and save it.

2010-06-03 Thread Adam Reed
With respect, file manipulation is a basic feature of Ruby.  WATIR is
a testing library/tool that makes use of the basic built-in Ruby
functionality.  That is the distinction that is being made.

In your case, you would need to design a way to locate the Order Id,
temporarily assign that value to a variable, open or create a text
file, and finally write this value to the file.

Which step in that process are you having difficulty coding?

Thanks,
Adam

On Jun 3, 9:17 am, meaculpa  wrote:
> Its WATIR specific only. And This is not a blanket request for help.
>
> Everyone in this forum are having experience and they are not just
> NOOBS. So they can surely understand what i mean... Also After
> googling only I post here...
>
> I believe this group is mainly for helping each other than creating
> specific rules !!!
>
> I accept that my question was little.
>
> My actual problem is :
>
> From a webpage I get a Order Id. I want to save that in a notepad. I
> googled and didnt find any help.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


RE: [wtr-general] Re: How to create a file and save it.

2010-06-03 Thread Rohan Premvallabh Ojha
Hi,

You can have something like.

f=File.new(fileName,"w")   # to create a new text file
f.puts(variableName) # to input that in your text file 
(have it in a while loop for multiple values)
f.close

Hope this will help you.:)

Cheers and Chill..

Thanks
Rohan Ojha
00 44 07950310117

From: watir-general@googlegroups.com [watir-gene...@googlegroups.com] On Behalf 
Of meaculpa [harismah...@gmail.com]
Sent: 03 June 2010 19:47
To: Watir General
Subject: [wtr-general] Re: How to create a file and save it.

Its WATIR specific only. And This is not a blanket request for help.

Everyone in this forum are having experience and they are not just
NOOBS. So they can surely understand what i mean... Also After
googling only I post here...

I believe this group is mainly for helping each other than creating
specific rules !!!

I accept that my question was little.

My actual problem is :

>From a webpage I get a Order Id. I want to save that in a notepad. I
googled and didnt find any help.

--
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: How to create a file and save it.

2010-06-03 Thread meaculpa


Its WATIR specific only. And This is not a blanket request for help.

Everyone in this forum are having experience and they are not just
NOOBS. So they can surely understand what i mean... Also After
googling only I post here...

I believe this group is mainly for helping each other than creating
specific rules !!!

I accept that my question was little.

My actual problem is :

>From a webpage I get a Order Id. I want to save that in a notepad. I
googled and didnt find any help.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: How to create a file and save it.

2010-06-03 Thread Adam Reed
I agree with Jason, and I would also recommend "Everyday Scripting
with Ruby"/Marick - great book for scripters that know more about
WATIR than they do about Ruby.

http://pragprog.com/titles/bmsft/everyday-scripting-with-ruby

On Jun 3, 8:30 am, Jason Trebilcock 
wrote:
> Watir is really a tool for interacting with web applications.  For what you
> want to do, you may want to rephrase the question as being Ruby-specific and
> not related to Watir. Further, you may want to invest a little time
> researching your problem.  There are plenty of resources available to help
> you solve this problem.
>
> An initial hint is to google for 'ruby creating text file'.
> After that, once you have some code, you may want to reach out to a Ruby
> mailing list for further help.  But, note that when you do reach out for
> help, there is going to be an expectation that you have specific questions
> that you're not able to solve rather than a blanket request for help.
>
> On Thu, Jun 3, 2010 at 7:28 AM, meaculpa  wrote:
> > I need to create a text file and save it using watir.
>
> > How is it possible. Can anybody help ?
>
> > --
> > Before posting, please readhttp://watir.com/support. In short: search
> > before you ask, be nice.
>
> > You received this message because you are subscribed to
> >http://groups.google.com/group/watir-general
> > To post: watir-general@googlegroups.com
> > To unsubscribe: 
> > watir-general+unsubscr...@googlegroups.com
>
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Bad File Descriptor

2010-06-03 Thread Adam Reed
Betsy, I see "Bad File Descriptor" listed in parts of many completely
unrelated error messages.  Could you please post the full error
message and/or any relevant code?

Thanks
Adam

On Jun 3, 4:46 am, Betsy  wrote:
> Still waiting for a reply!!!
>
> On Jun 2, 7:31 pm, Betsy  wrote:
>
> > Hi all,
>
> > Can anyone list down the general causes of a "Bad File Descriptor"
> > error?
>
> > Thanks,
> > Betsy Joy.
>
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Problem with a listbox that populates to many data

2010-06-03 Thread joedio
Marlon,

Perhaps checking the browser's status bar to see that the status is
"Done" may work. I've run into similar situations when testing SOAP
applications where a user interaction on one element on the page
triggers the population of a select list. If you're app is written
well, the status text will be changed from "Done" when the trigger
event occurs, and will not be set back to "Done" until after the
select list is populated. If that's the case here try putting a loop
into you code between the trigger event and the line that tries to
access your select_list item. Here's a simple example, with a timeout
option so that it doesn't loop forever:


# Trigger your event that populates the select_list

sleep 1 # Add a short delay to allow time for the status bar text to
change from "Done"

# Define a starting value for the timeout
iTimeout = 0

# Loop until the status bar text to changes back to "Done" or the
timeout is exceeded
while((browser.status != "Done") || (iTimeout != 10 ) do
  sleep 1
  iTimeout +=1 # Increment the timeout value
end

# Access your  Select list


Joe


On Jun 3, 1:35 am, Marlon  wrote:
> Hi,
>
> I'm having a problem with my script due to performance issue with the
> site. The application has a Listbox that populates to many data
> resulting to a poor load time. I already used wait_until but it didn't
> help because the objects were already loaded but the data it not. One
> solution I can think of is to wait until the data on the listbox is
> completely loaded then perform the next operation, but how can I do
> it?
>
> Thanks
> -Lon

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] How to create a file and save it.

2010-06-03 Thread Jason Trebilcock
Watir is really a tool for interacting with web applications.  For what you
want to do, you may want to rephrase the question as being Ruby-specific and
not related to Watir. Further, you may want to invest a little time
researching your problem.  There are plenty of resources available to help
you solve this problem.

An initial hint is to google for 'ruby creating text file'.
After that, once you have some code, you may want to reach out to a Ruby
mailing list for further help.  But, note that when you do reach out for
help, there is going to be an expectation that you have specific questions
that you're not able to solve rather than a blanket request for help.

On Thu, Jun 3, 2010 at 7:28 AM, meaculpa  wrote:

> I need to create a text file and save it using watir.
>
> How is it possible. Can anybody help ?
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> You received this message because you are subscribed to
> http://groups.google.com/group/watir-general
> To post: watir-general@googlegroups.com
> To unsubscribe: 
> watir-general+unsubscr...@googlegroups.com
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] How to create a file and save it.

2010-06-03 Thread meaculpa
I need to create a text file and save it using watir.

How is it possible. Can anybody help ?

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Bad File Descriptor

2010-06-03 Thread Betsy
Still waiting for a reply!!!

On Jun 2, 7:31 pm, Betsy  wrote:
> Hi all,
>
> Can anyone list down the general causes of a "Bad File Descriptor"
> error?
>
> Thanks,
> Betsy Joy.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Nil Class error

2010-06-03 Thread Chandu80
I have a piece of code as follows.
Here after the Save button is clicked   a pop-up appears with an OK
button.
The pop-up needs to be clicked(on the OK button) or closed for the
script to run further.
This piece of code is run in iterations.It runs fine for a few
iterations(say 2 or 3) and then gives a NilClass error at line
indicated by **


 ###The Code##
 g.save.click_no_wait  #Click on the Save button
  Watir.autoit.WinWait('Windows Internet Explorer') #Wait for the
pop-up
  windw_exist = Watir.autoit.WinExists('Windows Internet
Explorer')#Check if the pop-up exists
  puts "Window Exist = #{windw_exist}"
  windw_active = Watir.autoit.WinActive('Windows Internet
Explorer')#Check if the pop-up is active
  puts "Window Active = #{windw_active}"
  Watir.autoit.WinClose('Windows Internet Explorer')#Close the pop-
up
  #g.jsClick('Windows Internet Explorer', 'OK')
  Watir::Waiter.wait_until(5) { g.edit.exists?}**   #Wait
for the Edit button to appear.
  g.edit.click  #Click on the Edit button
  #The End##


The actual error seen is as follows

 c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/container.rb:
679:in `ole_i
nner_elements'c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
container.rb:
741:in `locate_input_element'c:/ruby/lib/ruby/gems/1.8/gems/
watir-1.6.2/lib/wati
r/input_elements.rb:5:in `locate'c:/ruby/lib/ruby/gems/1.8/gems/
watir-1.6.2/lib/
watir/element.rb:273:in `exists?'C:/Lmg_test/ruby/03.06.2010/driver/
cfg_messag2.
rb:102c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/lib/watir/
waiter.rb:80:in
 `wait_until'c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/lib/
watir/waiter.r
b:57:in `wait_until'c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/
lib/watir/w
aiter.rb:80:in `wait_until'C:/Lmg_test/ruby/03.06.2010/driver/
cfg_messag2.rb:102


 undefined method `all' for nil:NilClass

*
My queries
1)What value is being returned Nil.
2)How to check the parameter that is returning the nil value.
3)Is it the Edit button.exists that is being shown nil?
4)Should the wait_until time be increased?

Kindly let me know the answers to the above queries.
Please let me know if you need more information on this.

Thanks in Advance

Regards
Chandrika

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: AutoItX3 failing on virtual machine when remote desktop window minimized/closed

2010-06-03 Thread Chuck van der Linden
Most virtualization platforms have an option for a connection that
looks to the virtualised OS like the 'console' and is thus treated
differently by the OS than a RDP session.

For example Hyper-V provides a way to connect to the VM via Virtual
Machine Manager (or at least one sidebar gadget) and it appears to the
VM that you are at the physical 'console' of the system.There
might be enough difference from such a session and your normal RDP
session that stuff could continue to work (I've not tried it)

Unfortunately that capability only works from a system with more
recent MS security, e.g. Vista, Win7, or Server2008  so you'd not be
able to do it on your xp laptop in any case.

On Jun 2, 11:05 am, koicat  wrote:
> Bill,
> Thanks for the response!  Wish it were better news...  RDP also whacks
> screenshots unless there is an active session.   Not only that but it
> must be the session where the browser and watir are running. RDP
> presents independant desktops to each session.
> Unfortunately, leaving the (correct) session open is my only option at
> the moment since RDP is the only allowed access to this VM.
>
> Thanks again!
> pat
>
> On May 21, 3:42 pm, Bill Agee  wrote:
>
>
>
> > Lots of people have run into this, and it seems the only workaround is to
> > leave a user logged in to the remote machine at all times.
>
> > Then, if you need to access the console of the VM where your tests are
> > running, and using the RDP client interrupts execution of your tests, you
> > can try a different method of accessing the console.
>
> > VNC or the console utility provided by your virtualization vendor (such as
> > the vSphere client or VMware Server Console, if using VMware) shouldn't
> > interfere with the desktop on the remote machine.
>
> > Thanks
> > Bill
>
> > On Fri, May 21, 2010 at 2:38 PM, koicat  wrote:
> > > Am running ruby and watir 1.6.5 which uses AutoItX3.dll (v. 3.1.1) on
> > > a Windows Server 2003 virtual machine accessed from an XP Pro laptop
> > > through Remote Desktop.
>
> > > If I run the script and leave the desktop window open, the following
> > > code runs correctly.
> > > If I minimize the window the code hangs after the WinActivate command
> > > (the WinWait for "Save As" also never times out)
>
> > > Have substituted a newer version of AutoItX3.dll (v 3.3.3) to no
> > > avail.
>
> > >   �...@wait = 60
> > >    data_path = [full path where file is to be saved]
> > >    ...
> > >    ai = WIN32OLE.new("AutoItX3.Control")
> > >    ai.WinWait("File Download", "", @Wait)
> > >    ai.WinActivate("File Download", "")
> > >    ai.ControlFocus("File Download", "", "&Save")
> > >    sleep 1
> > >    ai.ControlClick("File Download", "", "&Save", "primary")
> > >    sleep 1
> > >    ai.WinWait("Save As", "", @Wait)
> > >    sleep 0.5
> > >    ai.ControlSend("Save As", "", "Edit1", data_path)
> > >    ai.ControlClick("Save As", "", "&Save", "left")
> > >    ai.WinWait("Download complete", "", @Wait)
> > >    ai.ControlClick("Download complete", "", "Close")
> > >    ...
>
> > > This is an urgent problem as the application running this is a
> > > critical path project.
> > > Greatly appreciate any help anyone can give!
>
> > > --
> > > Before posting, please readhttp://watir.com/support. In short: search
> > > before you ask, be nice.
>
> > > You received this message because you are subscribed to
> > >http://groups.google.com/group/watir-general
> > > To post: watir-general@googlegroups.com
> > > To unsubscribe: 
> > > watir-general+unsubscr...@googlegroups.com
>
> > --
> > Before posting, please readhttp://watir.com/support. In short: search 
> > before you ask, be nice.
>
> > You received this message because you are subscribed 
> > tohttp://groups.google.com/group/watir-general
> > To post: watir-general@googlegroups.com
> > To unsubscribe: watir-general+unsubscr...@googlegroups.com- Hide quoted 
> > text -
>
> - Show quoted text -

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Problem with a listbox that populates to many data

2010-06-03 Thread Marlon
Hi,

I'm having a problem with my script due to performance issue with the
site. The application has a Listbox that populates to many data
resulting to a poor load time. I already used wait_until but it didn't
help because the objects were already loaded but the data it not. One
solution I can think of is to wait until the data on the listbox is
completely loaded then perform the next operation, but how can I do
it?


Thanks
-Lon

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com