[wtr-general] Re: How works file_field set method

2008-12-04 Thread pierrelebai...@gmail.com

Hi
That's exactly what I done and it works...it would be great if Watir
will be able to work with dictonary file parameter...one day
perhaps...

thank's for the link.
Pierre

On 5 déc, 01:48, "Bill Agee" <[EMAIL PROTECTED]> wrote:
> The French OS could be the issue.  It looks like a similar ira bug exists:
>
> http://jira.seleniumhq.org/browse/WTR-21
>
> I'm using Watir 1.5.6, so on your version there may be
> differences...but on my machine, the English title text for the
> "Choose file" dialog is hardcoded in this file:
>
> \ruby\lib\ruby\gems\1.8\gems\watir-1.5.6\watir\input_elements.rb
>
> On line 443 (inside the set method), I see this:
>
>   system("rubyw -e \"require 'win32ole';
> @autoit=WIN32OLE.new('AutoItX3.Control'); [EMAIL PROTECTED]
> 'Choose file', '', 15; sleep 1; if waitresult == 1\" -e
> \"@autoit.ControlSetText 'Choose file', '', 'Edit1', '#{setPath}';
> @autoit.ControlSend 'Choose file', '', 'Button2', '{ENTER}';\" -e
> \"end\"")
>
> If you want to try a workaround, try changing the three instances of
> the string "Choose file" on that line to the equivalent dialog title
> IE displays on your machine.
>
> If you can get it working, it might be useful to document the
> workaround in the comments for the Jira ticket.
>
> The string "Choose file" also appears a few times in winClicker.rb,
> but I don't think the file field code in there is used anymore (unless
> I'm misreading the source).
>
> On 12/4/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > I ask myself does file_field set method works in French Operating
> > System ?
>
> > On 4 déc, 21:26, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
> > > Hi Wesley,
>
> > > thank's for so quickly answer...
> > > I ask myself why there is a IE.attach(...) command before upload ? is
> > > it for attach the open file dialog ? what must I type in (...) as
> > > attach parameter ?
>
> > > On 4 déc, 16:40, "wesley chen" <[EMAIL PROTECTED]> wrote:
>
> > > > Below code, is for english operation system and upload two files: 
> > > > c:\*.jpg
> > > > and c:\*.xls
> > > > def upload_file(ie, filepath,index=1)
> > > > if filepath.include?("/")
> > > > filepath.gsub!("/","\\")
> > > > end
> > > > ie.file_field(:id,"theFile[#{index-1}]").set(filepath)
> > > > end
>
> > > > ie=Watir::IE.attach(...)
> > > > upload_file(ie,"c:\\Calendar_Day_Add+1.jpg")
> > > > upload_file(ie, "c:\\TC_TRAIN_3156.xls",2)
>
> > > > Thanks.
> > > > Wesley Chen.
>
> > > > On Thu, Dec 4, 2008 at 10:49 PM, [EMAIL PROTECTED] <
>
> > > > [EMAIL PROTECTED]> wrote:
>
> > > > > Hi,
>
> > > > > I try to find all over the post, I read and I read post ...but I have
> > > > > no the answer for my problem...
>
> > > > > I use file_field set method  ( I find how regsiter th AutoItX3.dll
> > > > > Wahou !!) so now the dialogue box appears...
> > > > > But (there is always a But)... it dosen't select my file putted with
> > > > > the set method...
>
> > > > > I read some post about the file extension association with the dialog
> > > > > box "open file" And when I look my Dialog box I see "photos
> > > > > (*.jpg,*.bmp...) and HTML (*.html)" but my upload file is a zip one...
>
> > > > > I don't know (find) how to change this extension file association and
> > > > > help my test to select my file and upload it automatically.
>
> > > > > Thank's you for your help.
> > > > > pleb newbie watir...- Masquer le texte des messages précédents -
>
> > > - Afficher le texte des messages précédents -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Dealing with Java script pop up -- Please help

2008-12-04 Thread Jagdeep Jain

Thanks Chen,

Now the same error is not coming up.

Thanks Again!
Jagdeep Jain

On Dec 4, 8:49 pm, "wesley chen" <[EMAIL PROTECTED]> wrote:
> I am sure if you search detailed in the group, you can get the solution.
> Below is one way to deal with the problem.
> require 'watir'
> def popup_clicker(ie,buttonname)
>     require 'watir/contrib/enabled_popup'
>     require 'win32ole'
>     hwnd = ie.enabled_popup(5)
>     if(hwnd)  #yeah! a popup
>         popup = WinClicker.new
>         popup.makeWindowActive(hwnd) #Activate the window.
>         popup.clickWindowsButton_hwnd(hwnd,buttonname) #Click the button
>         #popup.clickWindowsButton(/Internet/,buttonname,30)
>         popup=nil
>     end
> end
> ie=Watir::IE.attach(:title,/javascript/)
> ie.link(:text,/click/i).click_no_wait
> popup_clicker(ie,"OK")
>
> Thanks.
> Wesley Chen.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Methods

2008-12-04 Thread Rand Thacker
Yes, the test case methods need to be within a class that derived from
Watir::TestCase.

On Thu, Dec 4, 2008 at 4:44 PM, Sowmya <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> When ever i am creating methods in watir... it seems that the program
> is skipping the newly created method.
> Why do you think it is happening?
> The following is the snippet of the code i have written. Initially the
> method named test_login_page was never called. Then after a while it
> started working.
> Then when i created another method new_cust_perform now that does not
> get called. What should i do? Where am i going wrong?
> Please help.
>
> require 'watir'
> require 'rubygems'
> require 'URI'
> require 'watir/testcase'
> require 'create_new'
>
>
>
>  def test_start
>
># $ie.speed = :zippy
>puts "Beginning of test: BERT."
>$ie = Watir::IE.new
>$ie.goto $site
>
> end
>
>  def test_login_page
>
> begin
>assert($ie.text_field(:name, "username").exists?,"text
> user does not exist on " + $ie.url)
>puts 'Assertion passed'
>
>rescue StandardError => ex
>print "\n\n Error => " + ex + "\n\n"
>raise
>
>ensure
>end
>
>$ie.text_field(:name, "username").set("sowmya")
>$ie.text_field(:name,"password").set("qa1234")
>$ie.button(:value, "Login").click
>
> end
>
>  def new_cust_perform
>new_cust_create
>
>  end
>
> >
>


-- 
"I am the most humble person in the world!"

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Methods

2008-12-04 Thread wesley chen
require 'watir'
require 'rubygems'
require 'watir/testcase'  # First, you have to require 'watir/testcase'
class Test1 http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Methods

2008-12-04 Thread Sowmya

Hi,

When ever i am creating methods in watir... it seems that the program
is skipping the newly created method.
Why do you think it is happening?
The following is the snippet of the code i have written. Initially the
method named test_login_page was never called. Then after a while it
started working.
Then when i created another method new_cust_perform now that does not
get called. What should i do? Where am i going wrong?
Please help.

require 'watir'
require 'rubygems'
require 'URI'
require 'watir/testcase'
require 'create_new'



 def test_start

# $ie.speed = :zippy
puts "Beginning of test: BERT."
$ie = Watir::IE.new
$ie.goto $site

end

 def test_login_page

 begin
assert($ie.text_field(:name, "username").exists?,"text
user does not exist on " + $ie.url)
puts 'Assertion passed'

rescue StandardError => ex
print "\n\n Error => " + ex + "\n\n"
raise

ensure
end

$ie.text_field(:name, "username").set("sowmya")
$ie.text_field(:name,"password").set("qa1234")
$ie.button(:value, "Login").click

end

  def new_cust_perform
new_cust_create

  end

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How works file_field set method

2008-12-04 Thread Bill Agee
The French OS could be the issue.  It looks like a similar ira bug exists:

http://jira.seleniumhq.org/browse/WTR-21

I'm using Watir 1.5.6, so on your version there may be
differences...but on my machine, the English title text for the
"Choose file" dialog is hardcoded in this file:

\ruby\lib\ruby\gems\1.8\gems\watir-1.5.6\watir\input_elements.rb

On line 443 (inside the set method), I see this:

  system("rubyw -e \"require 'win32ole';
@autoit=WIN32OLE.new('AutoItX3.Control'); [EMAIL PROTECTED]
'Choose file', '', 15; sleep 1; if waitresult == 1\" -e
\"@autoit.ControlSetText 'Choose file', '', 'Edit1', '#{setPath}';
@autoit.ControlSend 'Choose file', '', 'Button2', '{ENTER}';\" -e
\"end\"")

If you want to try a workaround, try changing the three instances of
the string "Choose file" on that line to the equivalent dialog title
IE displays on your machine.

If you can get it working, it might be useful to document the
workaround in the comments for the Jira ticket.

The string "Choose file" also appears a few times in winClicker.rb,
but I don't think the file field code in there is used anymore (unless
I'm misreading the source).


On 12/4/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I ask myself does file_field set method works in French Operating
> System ?
>
> On 4 déc, 21:26, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
> > Hi Wesley,
> >
> > thank's for so quickly answer...
> > I ask myself why there is a IE.attach(...) command before upload ? is
> > it for attach the open file dialog ? what must I type in (...) as
> > attach parameter ?
> >
> > On 4 déc, 16:40, "wesley chen" <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Below code, is for english operation system and upload two files: c:\*.jpg
> > > and c:\*.xls
> > > def upload_file(ie, filepath,index=1)
> > > if filepath.include?("/")
> > > filepath.gsub!("/","\\")
> > > end
> > > ie.file_field(:id,"theFile[#{index-1}]").set(filepath)
> > > end
> >
> > > ie=Watir::IE.attach(...)
> > > upload_file(ie,"c:\\Calendar_Day_Add+1.jpg")
> > > upload_file(ie, "c:\\TC_TRAIN_3156.xls",2)
> >
> > > Thanks.
> > > Wesley Chen.
> >
> > > On Thu, Dec 4, 2008 at 10:49 PM, [EMAIL PROTECTED] <
> >
> > > [EMAIL PROTECTED]> wrote:
> >
> > > > Hi,
> >
> > > > I try to find all over the post, I read and I read post ...but I have
> > > > no the answer for my problem...
> >
> > > > I use file_field set method  ( I find how regsiter th AutoItX3.dll
> > > > Wahou !!) so now the dialogue box appears...
> > > > But (there is always a But)... it dosen't select my file putted with
> > > > the set method...
> >
> > > > I read some post about the file extension association with the dialog
> > > > box "open file" And when I look my Dialog box I see "photos
> > > > (*.jpg,*.bmp...) and HTML (*.html)" but my upload file is a zip one...
> >
> > > > I don't know (find) how to change this extension file association and
> > > > help my test to select my file and upload it automatically.
> >
> > > > Thank's you for your help.
> > > > pleb newbie watir...- Masquer le texte des messages précédents -
> >
> > - Afficher le texte des messages précédents -
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How works file_field set method

2008-12-04 Thread [EMAIL PROTECTED]

I find the problem, winClicker.rb and input_elements.rb works only in
English.
I have translate in the code and now it works in french...

sometime the night help youself...but sometime you don't understand
how such Idea comes in your mind...but it comes...and it's
beautiful...good night..and Thank's

On 5 déc, 01:21, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I ask myself does file_field set method works in French Operating
> System ?
>
> On 4 déc, 21:26, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Hi Wesley,
>
> > thank's for so quickly answer...
> > I ask myself why there is a IE.attach(...) command before upload ? is
> > it for attach the open file dialog ? what must I type in (...) as
> > attach parameter ?
>
> > On 4 déc, 16:40, "wesley chen" <[EMAIL PROTECTED]> wrote:
>
> > > Below code, is for english operation system and upload two files: c:\*.jpg
> > > and c:\*.xls
> > > def upload_file(ie, filepath,index=1)
> > > if filepath.include?("/")
> > > filepath.gsub!("/","\\")
> > > end
> > > ie.file_field(:id,"theFile[#{index-1}]").set(filepath)
> > > end
>
> > > ie=Watir::IE.attach(...)
> > > upload_file(ie,"c:\\Calendar_Day_Add+1.jpg")
> > > upload_file(ie, "c:\\TC_TRAIN_3156.xls",2)
>
> > > Thanks.
> > > Wesley Chen.
>
> > > On Thu, Dec 4, 2008 at 10:49 PM, [EMAIL PROTECTED] <
>
> > > [EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > I try to find all over the post, I read and I read post ...but I have
> > > > no the answer for my problem...
>
> > > > I use file_field set method  ( I find how regsiter th AutoItX3.dll
> > > > Wahou !!) so now the dialogue box appears...
> > > > But (there is always a But)... it dosen't select my file putted with
> > > > the set method...
>
> > > > I read some post about the file extension association with the dialog
> > > > box "open file" And when I look my Dialog box I see "photos
> > > > (*.jpg,*.bmp...) and HTML (*.html)" but my upload file is a zip one...
>
> > > > I don't know (find) how to change this extension file association and
> > > > help my test to select my file and upload it automatically.
>
> > > > Thank's you for your help.
> > > > pleb newbie watir...- Masquer le texte des messages précédents -
>
> > - Afficher le texte des messages précédents -- Masquer le texte des 
> > messages précédents -
>
> - Afficher le texte des messages précédents -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How works file_field set method

2008-12-04 Thread [EMAIL PROTECTED]

I ask myself does file_field set method works in French Operating
System ?

On 4 déc, 21:26, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi Wesley,
>
> thank's for so quickly answer...
> I ask myself why there is a IE.attach(...) command before upload ? is
> it for attach the open file dialog ? what must I type in (...) as
> attach parameter ?
>
> On 4 déc, 16:40, "wesley chen" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Below code, is for english operation system and upload two files: c:\*.jpg
> > and c:\*.xls
> > def upload_file(ie, filepath,index=1)
> > if filepath.include?("/")
> > filepath.gsub!("/","\\")
> > end
> > ie.file_field(:id,"theFile[#{index-1}]").set(filepath)
> > end
>
> > ie=Watir::IE.attach(...)
> > upload_file(ie,"c:\\Calendar_Day_Add+1.jpg")
> > upload_file(ie, "c:\\TC_TRAIN_3156.xls",2)
>
> > Thanks.
> > Wesley Chen.
>
> > On Thu, Dec 4, 2008 at 10:49 PM, [EMAIL PROTECTED] <
>
> > [EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > I try to find all over the post, I read and I read post ...but I have
> > > no the answer for my problem...
>
> > > I use file_field set method  ( I find how regsiter th AutoItX3.dll
> > > Wahou !!) so now the dialogue box appears...
> > > But (there is always a But)... it dosen't select my file putted with
> > > the set method...
>
> > > I read some post about the file extension association with the dialog
> > > box "open file" And when I look my Dialog box I see "photos
> > > (*.jpg,*.bmp...) and HTML (*.html)" but my upload file is a zip one...
>
> > > I don't know (find) how to change this extension file association and
> > > help my test to select my file and upload it automatically.
>
> > > Thank's you for your help.
> > > pleb newbie watir...- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Security Alert frustration

2008-12-04 Thread Bill Agee

Sounds like what you need is to start a separate process or thread to
wait for, then interact with, the dialog.

As you've seen, for this type of dialog task, there's more than one
way to do it. :)  And as far as I know the Watir community does not
endorse any single "right" way to handle SSL dialogs.  Many have
tackled the problem, but but no single attempt has emerged as the
clear winner yet.

Also, as Bret mentioned on the list recently, dialog issues can also
be solved by taking steps to prevent the dialog from appearing at all.
 In your case (since it's an SSL-related dialog with a "Yes" button)
it sounds like you're seeing the "Yes/No/Cancel" alert indicating that
IE does not trust the certificate.  You can avoid that dialog by
importing the site's SSL cert into your trusted certificate store in
IE.  (This is worth investigating if the certificate does not change
often.)

But as for how to automate clicking on the "Yes" button, try this.
It's clunky, but until a better solution comes along, this pattern
works.

1) Create a new file, named:

click_yes_ssl_cert_dialog.rb

2) Inside it, paste the necessary code to click the dialog's 'Yes' button:

require 'watir'

Watir.autoit.WinWait "Security Alert", ""
Watir.autoit.ControlClick "Security Alert", "", "&Yes"

3) Now, back in your primary script, invoke the helper script just
before you call IE.start_process.  You can use this line:

system('start click_yes_ssl_cert_dialog.rb')

That fires off a second command interpreter and to run the helper
script, and the script does not wait for it to return.  So your main
script can continue on to start the browser while the helper script
churns away in the background waiting for the dialog.


An important note: Be sure to place the main script and the helper
script in the same directory, and launch the main script from that
directory as well.  If you try launching the script from a different
dir, you'll need some extra code to make sure the main script can find
the helper script.


On 12/3/08, winstan <[EMAIL PROTECTED]> wrote:
>
> Hi Bill,
>
> You're correct, as soon as the browser tries to navigate to that URL
> it just hangs as it cannot control the "Security Alert" pop up dialog
> and accept yes. Out of all the examples that i have attempted in my
> script, which one would you suggest i use and attempt to get working.
>
> I just attempted to do as you stated by moving the popup-handling code
> above the "ie = Watir::IE.start_process(webserv_v4)" but still the
> same issue is evident where it cannot handle the pop-up, hence my
> above question.
>
> Thanks for your assistance with this.
>
> On Dec 4, 3:10 pm, "Bill Agee" <[EMAIL PROTECTED]> wrote:
> > Does your script block at the following line and not continue?  Or is there
> > some other problem?
> >
> > ie = Watir::IE.start_process(webserv_v4)
> >
> > If that line is where things go wrong, try moving the popup-handling code
> > above that line - otherwise the Security Alert dialog is probably going to
> > prevent your script from reaching the next line.
> >
> > On Wed, Dec 3, 2008 at 5:02 PM, winstan <[EMAIL PROTECTED]>wrote:
> >
> >
> >
> >
> >
> > > Hey Guys,
> >
> > > Second post here, and unfortunately, is related to a topic that has
> > > been discussed to no end. The security alert pop-up associated with
> > > IE6 and certificated URL's. I have searched high and low and have
> > > tried every possible solution I have come by but still to no prevail,
> > > I still can't click the yes on the security alert dialogue. Please
> > > could you more savvy water guys take a look at my script and perhaps
> > > point me in the right direction.
> >
> > > Bear in mind it is a mess as I have been trying to resolve the
> > > security pop up issue I am having and at the same time this is just a
> > > simple spike script as a proof of concept.
> >
> > > Many thanks with anticipation.
> >
> > > W
> >
> > > ===­=
> >
> > > require 'watir'
> > > require 'watir/ie'
> > > require 'watir/contrib/enabled_popup'
> > > require 'watir/WindowHelper'
> > > require 'watir/winClicker'
> >
> > >  def push_security_alert_yes
> > >Watir.autoit.WinWait "Security Alert", ""
> > >Watir.autoit.Send "{TAB}"
> > >Watir.Send "{TAB}"
> > >Watir.Send "{SPACE}"
> > >end
> >
> > > #def startClicker(browser, button_label, waitTime= 9, user_input=nil)
> > >  # get a handle if one exists
> > >  #hwnd = browser.enabled_popup(waitTime)
> > >  #if(hwnd)  # yes there is a popup
> > >#w = WinClicker.new
> > >#if(user_input)
> > >  #w.setTextValueForFileNameField(hwnd, user_input.to_s)
> > >#end
> > ># I put this in to see the text being input it is not necessary to
> > > work
> > >#sleep 3
> > ># "OK" or whatever the name on the button is
> > >#w.clickWindowsButton_hwnd(hwnd, button_label.to_s)
> > ># this is just cleanup
> > >#w = nil
> > >  #end
> > >

[wtr-general] Re: How works file_field set method

2008-12-04 Thread [EMAIL PROTECTED]

Hi Wesley,

thank's for so quickly answer...
I ask myself why there is a IE.attach(...) command before upload ? is
it for attach the open file dialog ? what must I type in (...) as
attach parameter ?


On 4 déc, 16:40, "wesley chen" <[EMAIL PROTECTED]> wrote:
> Below code, is for english operation system and upload two files: c:\*.jpg
> and c:\*.xls
> def upload_file(ie, filepath,index=1)
> if filepath.include?("/")
> filepath.gsub!("/","\\")
> end
> ie.file_field(:id,"theFile[#{index-1}]").set(filepath)
> end
>
> ie=Watir::IE.attach(...)
> upload_file(ie,"c:\\Calendar_Day_Add+1.jpg")
> upload_file(ie, "c:\\TC_TRAIN_3156.xls",2)
>
> Thanks.
> Wesley Chen.
>
> On Thu, Dec 4, 2008 at 10:49 PM, [EMAIL PROTECTED] <
>
> [EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I try to find all over the post, I read and I read post ...but I have
> > no the answer for my problem...
>
> > I use file_field set method  ( I find how regsiter th AutoItX3.dll
> > Wahou !!) so now the dialogue box appears...
> > But (there is always a But)... it dosen't select my file putted with
> > the set method...
>
> > I read some post about the file extension association with the dialog
> > box "open file" And when I look my Dialog box I see "photos
> > (*.jpg,*.bmp...) and HTML (*.html)" but my upload file is a zip one...
>
> > I don't know (find) how to change this extension file association and
> > help my test to select my file and upload it automatically.
>
> > Thank's you for your help.
> > pleb newbie watir...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: browser.attach

2008-12-04 Thread Moochie

I've been using 1.6.2 and I use this browser.attache method with know
problems.

On Dec 4, 1:46 pm, Bret Pettichord <[EMAIL PROTECTED]> wrote:
> Where do you see that it is not supported?
>
>
>
> aidy lewis wrote:
> > Hi,
>
> > On the wiki I am informed that the browser.attach method is not
> > supported in 1.6.2
>
> > What alternative method can I use to hook onto an existing browser?
>
> > Aidy- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: browser.attach

2008-12-04 Thread Bret Pettichord

Where do you see that it is not supported?

aidy lewis wrote:
> Hi,
>
> On the wiki I am informed that the browser.attach method is not
> supported in 1.6.2
>
> What alternative method can I use to hook onto an existing browser?
>
> Aidy
>
> >
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] run javascript and recover the value

2008-12-04 Thread pelvin

I have the following code:


I would like to recover the value of the variable

ie.document.parentWindow.execScript("
 function msieversion(){

  var ua = window.navigator.userAgent
  var msie = ua.indexOf ( 'MSIE ' )


  var a = ua.substring (msie+5, ua.indexOf ('.', msie ))
  return a
  }
 msieversion()
")

I would like to recover the value of the variable  a
to use it in the ruby program

thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] browser.attach

2008-12-04 Thread aidy lewis

Hi,

On the wiki I am informed that the browser.attach method is not
supported in 1.6.2

What alternative method can I use to hook onto an existing browser?

Aidy

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general?hl=en
-~--~~~~--~~--~--~---



[wtr-general] Re: Capturing data within an xml

2008-12-04 Thread Richard Lawrence

You really don't want to be reinventing XML parsing (badly) with
string substitution or regular expressions. Given a string with your
XML in it, the REXML code to get the values you want would look
something like the following. You'll have to use something like
Net::Http to actually make the web service call to get the XML string.
There are some decent examples here:
http://rubylearning.com/blog/2008/04/25/yahoo-web-services-in-ruby/.

As Alex recommended, play around in irb with this to get a feel for it.


require 'rexml/document'

xml = 'FooBar'

doc = REXML::Document.new(xml)

firstName = REXML::XPath.first(doc.root, '//firstName/text()')
lastName = REXML::XPath.first(doc.root, '//lastName/text()')


Richard

On Thu, Dec 4, 2008 at 4:38 AM, Alex Collins <[EMAIL PROTECTED]> wrote:
>
> A useful general principle if you are wondering if something will work
> is to try it. In Ruby, start IRB (type irb at the command line) then
> type your ruby code. Irb will show you the results after each line.
> You do not need $ signs (ruby global variable) but you must certainly
> quote your strings. However your code will not work as there is no -
> method for a string.
>
> Instead, you could use the sub or gsub methods:
>
> a = "aba"
> a.gsub 'a', 'c'
> => "cbc"
>
> In the simple case, it sounds like you want to use a regular
> expression (regexp) to do pattern recognition. Results of matching are
> stores in MatchData objects. Something like:
>
> re = /(.*)<\pattern/>/
> matchdata = string.match(re)
> puts matchdata.captures
>
> However, if you want to do more than this you would be better using
> REXML  as Richard suggested. Alternatively, use a tool designed for
> testing XML webservices eg SOAPUI. Watir is designed for testing
> websites.
>
> You might want to read a ruby tutorial though to get a better idea of
> how to use ruby.
>
> Hope this helps.
>
> On 4 Dec 2008, at 06:40, winstan <[EMAIL PROTECTED]> wrote:
>
>>
>> Would i be able to do some thing like this:
>>
>> $a = TESTA
>> $b = 
>> $c = 
>> $d = a - b
>> $e = d - c
>>
>> which in turn would make $e "TESTA"?
>>
>>
>>
>> On Dec 4, 4:55 pm, "Richard Lawrence" <[EMAIL PROTECTED]> wrote:
>>> Why are you accessing the web service using Watir and IE? Will end
>>> users of the web service access it with a browser? If not, and if
>>> you're just using the web service to get data to use in other GUI
>>> tests, you might find something like Net::Http and REXML to be more
>>> appropriate for this part of your script.
>>>
>>> Richard
>>>
>>> --
>>> Richard Lawrence
>>> Certified Scrum Coach
>>> Founder and Principal Consultant, Humanizing Work, LLC
>>> 303-895-7688
>>> [EMAIL PROTECTED]
>>>
>>>
>>>
>>> On Wed, Dec 3, 2008 at 9:29 PM, winstan
>>> <[EMAIL PROTECTED]> wrote:
>>>
 Hi all,
>>>
 I'm trying to capture a variety of data in an xml response from a
 web
 service, that is served up via IE and the GUI, however when I
 interrogate the data using the IE dev toolbar I notice that all the
 element properties render useless as they are all of the same nature
 and properties.
>>>
 Bellow is an extract from an example xml response in which I want to
 capture the given Shortname and Long name (TestA) and set them as
 variables for use later in the script when accessing another system
 and validating the data between the two GUI's.
>>>
 TESTA
 TestA
>>>
 I hope the information provided is sufficient and understandable.
>>>
 Thanks again- Hide quoted text -
>>>
>>> - Show quoted text -
>>
>> >
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Dealing with Java script pop up -- Please help

2008-12-04 Thread wesley chen
I am sure if you search detailed in the group, you can get the solution.
Below is one way to deal with the problem.
require 'watir'
def popup_clicker(ie,buttonname)
require 'watir/contrib/enabled_popup'
require 'win32ole'
hwnd = ie.enabled_popup(5)
if(hwnd)  #yeah! a popup
popup = WinClicker.new
popup.makeWindowActive(hwnd) #Activate the window.
popup.clickWindowsButton_hwnd(hwnd,buttonname) #Click the button
#popup.clickWindowsButton(/Internet/,buttonname,30)
popup=nil
end
end
ie=Watir::IE.attach(:title,/javascript/)
ie.link(:text,/click/i).click_no_wait
popup_clicker(ie,"OK")

Thanks.
Wesley Chen.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: How works file_field set method

2008-12-04 Thread wesley chen
Below code, is for english operation system and upload two files: c:\*.jpg
and c:\*.xls
def upload_file(ie, filepath,index=1)
if filepath.include?("/")
filepath.gsub!("/","\\")
end
ie.file_field(:id,"theFile[#{index-1}]").set(filepath)
end

ie=Watir::IE.attach(...)
upload_file(ie,"c:\\Calendar_Day_Add+1.jpg")
upload_file(ie, "c:\\TC_TRAIN_3156.xls",2)


Thanks.
Wesley Chen.


On Thu, Dec 4, 2008 at 10:49 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I try to find all over the post, I read and I read post ...but I have
> no the answer for my problem...
>
> I use file_field set method  ( I find how regsiter th AutoItX3.dll
> Wahou !!) so now the dialogue box appears...
> But (there is always a But)... it dosen't select my file putted with
> the set method...
>
> I read some post about the file extension association with the dialog
> box "open file" And when I look my Dialog box I see "photos
> (*.jpg,*.bmp...) and HTML (*.html)" but my upload file is a zip one...
>
> I don't know (find) how to change this extension file association and
> help my test to select my file and upload it automatically.
>
> Thank's you for your help.
> pleb newbie watir...
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] How works file_field set method

2008-12-04 Thread pierrelebai...@gmail.com

Hi,

I try to find all over the post, I read and I read post ...but I have
no the answer for my problem...

I use file_field set method  ( I find how regsiter th AutoItX3.dll
Wahou !!) so now the dialogue box appears...
But (there is always a But)... it dosen't select my file putted with
the set method...

I read some post about the file extension association with the dialog
box "open file" And when I look my Dialog box I see "photos
(*.jpg,*.bmp...) and HTML (*.html)" but my upload file is a zip one...

I don't know (find) how to change this extension file association and
help my test to select my file and upload it automatically.

Thank's you for your help.
pleb newbie watir...

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Dealing with Java script pop up -- Please help

2008-12-04 Thread Jagdeep Jain

# Ruby Script for dealing with pop
require "watir"
require "logger"
require 'net/smtp'
require 'win32ole'
require 'watir/dialog'
require 'watir/ie'
require 'watir/contrib/enabled_popup'
require 'watir/WindowHelper'
require 'watir/winClicker'

# set a variable
test_site = "C:\\test.html"

# open the IE browser
ie = Watir::IE.new
#ie.maximize
ie.goto test_site

def startClicker( button , waitTime = 0.2)
  w = WinClicker.new
  longName = $ie.dir.gsub("/" , "\\" )
  shortName = w.getShortFileName(longName)
  c = "start rubyw #{shortName }\\watir\\clickJSDialog.rb
#{button }
  #{ waitTime} "
  puts "Starting #{c}"
  w.winsystem(c)
  w=nil
end

# starting the clicker
startClicker("OK")

#clicking the link which leads to pop up
ie.link(:test,"Click Here").click


##Testing the below HTML code:

function disp_alert()
{
alert("I am an alert box!!");
}

http://www.google.com"; onclick="disp_alert()" /> Click Here



Instead of http://www.google.com I am getting the following error
please help me with this
>ruby testhtml.rb
testhtml.rb:22:in `startClicker': undefined method `dir' for
nil:NilClass (NoMethodError)
from testhtml.rb:33
>Exit code: 1
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Capturing data within an xml

2008-12-04 Thread Alex Collins

A useful general principle if you are wondering if something will work  
is to try it. In Ruby, start IRB (type irb at the command line) then  
type your ruby code. Irb will show you the results after each line.  
You do not need $ signs (ruby global variable) but you must certainly  
quote your strings. However your code will not work as there is no -  
method for a string.

Instead, you could use the sub or gsub methods:

a = "aba"
a.gsub 'a', 'c'
=> "cbc"

In the simple case, it sounds like you want to use a regular  
expression (regexp) to do pattern recognition. Results of matching are  
stores in MatchData objects. Something like:

re = /(.*)<\pattern/>/
matchdata = string.match(re)
puts matchdata.captures

However, if you want to do more than this you would be better using  
REXML  as Richard suggested. Alternatively, use a tool designed for  
testing XML webservices eg SOAPUI. Watir is designed for testing  
websites.

You might want to read a ruby tutorial though to get a better idea of  
how to use ruby.

Hope this helps.

On 4 Dec 2008, at 06:40, winstan <[EMAIL PROTECTED]> wrote:

>
> Would i be able to do some thing like this:
>
> $a = TESTA
> $b = 
> $c = 
> $d = a - b
> $e = d - c
>
> which in turn would make $e "TESTA"?
>
>
>
> On Dec 4, 4:55 pm, "Richard Lawrence" <[EMAIL PROTECTED]> wrote:
>> Why are you accessing the web service using Watir and IE? Will end
>> users of the web service access it with a browser? If not, and if
>> you're just using the web service to get data to use in other GUI
>> tests, you might find something like Net::Http and REXML to be more
>> appropriate for this part of your script.
>>
>> Richard
>>
>> --
>> Richard Lawrence
>> Certified Scrum Coach
>> Founder and Principal Consultant, Humanizing Work, LLC
>> 303-895-7688
>> [EMAIL PROTECTED]
>>
>>
>>
>> On Wed, Dec 3, 2008 at 9:29 PM, winstan  
>> <[EMAIL PROTECTED]> wrote:
>>
>>> Hi all,
>>
>>> I'm trying to capture a variety of data in an xml response from a  
>>> web
>>> service, that is served up via IE and the GUI, however when I
>>> interrogate the data using the IE dev toolbar I notice that all the
>>> element properties render useless as they are all of the same nature
>>> and properties.
>>
>>> Bellow is an extract from an example xml response in which I want to
>>> capture the given Shortname and Long name (TestA) and set them as
>>> variables for use later in the script when accessing another system
>>> and validating the data between the two GUI's.
>>
>>> TESTA
>>> TestA
>>
>>> I hope the information provided is sufficient and understandable.
>>
>>> Thanks again- Hide quoted text -
>>
>> - Show quoted text -
>
> >

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Clicking tabs has no effect

2008-12-04 Thread LiquidBeard

This again causes it to flash yellow but with no effects in the
browser.

The DOM source shows the cell in question to look like this:

Working/Non-Working


On Dec 3, 8:20 pm, al3kc <[EMAIL PROTECTED]> wrote:
> Try ie.cell(:id, "tab2").fireEvent("onmousedown")
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Capturing data within an xml

2008-12-04 Thread winstan

Would i be able to do some thing like this:

$a = TESTA
$b = 
$c = 
$d = a - b
$e = d - c

which in turn would make $e "TESTA"?



On Dec 4, 4:55 pm, "Richard Lawrence" <[EMAIL PROTECTED]> wrote:
> Why are you accessing the web service using Watir and IE? Will end
> users of the web service access it with a browser? If not, and if
> you're just using the web service to get data to use in other GUI
> tests, you might find something like Net::Http and REXML to be more
> appropriate for this part of your script.
>
> Richard
>
> --
> Richard Lawrence
> Certified Scrum Coach
> Founder and Principal Consultant, Humanizing Work, LLC
> 303-895-7688
> [EMAIL PROTECTED]
>
>
>
> On Wed, Dec 3, 2008 at 9:29 PM, winstan <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > I'm trying to capture a variety of data in an xml response from a web
> > service, that is served up via IE and the GUI, however when I
> > interrogate the data using the IE dev toolbar I notice that all the
> > element properties render useless as they are all of the same nature
> > and properties.
>
> > Bellow is an extract from an example xml response in which I want to
> > capture the given Shortname and Long name (TestA) and set them as
> > variables for use later in the script when accessing another system
> > and validating the data between the two GUI's.
>
> > TESTA
> > TestA
>
> > I hope the information provided is sufficient and understandable.
>
> > Thanks again- Hide quoted text -
>
> - Show quoted text -

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Capturing data within an xml

2008-12-04 Thread winstan

Hi Richard,

To be quite honest with you here I am not entirely sure as to why the
business wants automation around the accessing the WS with a browser.
I’m relatively new here and have been set the task in my early days to
spike various automation tools and from what I have read and heard
ruby/watir is the way to go. So here I am.

None the less, no matter in which process I decide to go down
(retrieving the XML via the GUI or REXML) I will still need to
establish a way to identify the line from the XML I require removing
the XML tags from the line and storing the data as a variable. I have
been looking around all over the net but I'm unsure of what the words
are that I need to Google on, so I’m going around in circles.

>From my limited understanding I would assume it be possible for me to
identify the line in which I wish to set a variable to, but removing
the  &  from that line so that the variable is
just set to TESTA... am I wrong?

Thanks for your help

On Dec 4, 4:55 pm, "Richard Lawrence" <[EMAIL PROTECTED]> wrote:
> Why are you accessing the web service using Watir and IE? Will end
> users of the web service access it with a browser? If not, and if
> you're just using the web service to get data to use in other GUI
> tests, you might find something like Net::Http and REXML to be more
> appropriate for this part of your script.
>
> Richard
>
> --
> Richard Lawrence
> Certified Scrum Coach
> Founder and Principal Consultant, Humanizing Work, LLC
> 303-895-7688
> [EMAIL PROTECTED]
>
>
>
> On Wed, Dec 3, 2008 at 9:29 PM, winstan <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > I'm trying to capture a variety of data in an xml response from a web
> > service, that is served up via IE and the GUI, however when I
> > interrogate the data using the IE dev toolbar I notice that all the
> > element properties render useless as they are all of the same nature
> > and properties.
>
> > Bellow is an extract from an example xml response in which I want to
> > capture the given Shortname and Long name (TestA) and set them as
> > variables for use later in the script when accessing another system
> > and validating the data between the two GUI's.
>
> > TESTA
> > TestA
>
> > I hope the information provided is sufficient and understandable.
>
> > Thanks again- Hide quoted text -
>
> - Show quoted text -

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---