[wtr-general] Using Watir TestCase with RSpec - Problem

2009-01-15 Thread Jagdeep Jain

In the following code I am using Rspec for putting my results in
proper format.

If I am executing the below code by commenting the class declaration
then its working fine but if I want to use watir class here like the
code below then it not working and I got the following error on
console.

C:\RubyScripts\examplespec google.rb --format html  testresults.html
./google.rb:23:in `initialize': wrong number of arguments (0 for 1)
(ArgumentError)
from ./google.rb:23:in `new'
from ./google.rb:23
from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/
runner/example_group_runner.rb:14:in `load'
from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/
runner/example_group_runner.rb:14:in `load_files'
from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/
runner/example_group_runner.rb:13:in `each'
from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/
runner/example_group_runner.rb:13:in `load_files'
from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/
runner/options.rb:99:in `run_examples'
from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib/spec/
runner/command_line.rb:10:in `run'
from C:/Ruby/lib/ruby/gems/1.8/gems/rspec-1.1.11/bin/spec:4
from C:/Ruby/bin/spec:19:in `load'
from C:/Ruby/bin/spec:19


require 'watir'
require 'win32ole'
require 'watir/testcase'

$browser = Watir::IE.new
$browser.maximize

class TC_GoogleTest  Watir::TestCase
  def test_google
context Google's search page do
  setup do
$browser.goto('http://www.google.com')
  end

  specify should find ruby home page when I search for ruby do
$browser.text_field(:name, q).set(ruby)
$browser.button(:name, btnG).click
$browser.contains_text(rubyforge.org)
  end
end
  end
end

Please help me with this.

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



[wtr-general] Re: Using Watir TestCase with RSpec - Problem

2009-01-15 Thread John Kolokotronis

I forgot to note that the above code does not contain a valid
assertion so the test will always pass. You can fix this with a
should statement, like this:

$browser.contains_text(rubyforge.org).should != nil # contains_text
returns nil if no match is found...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Using Watir TestCase with RSpec - Problem

2009-01-15 Thread Jagdeep Jain

Thanks John, this is really help full.

On Jan 15, 4:36 pm, John Kolokotronis johnj...@gmail.com wrote:
 I forgot to note that the above code does not contain a valid
 assertion so the test will always pass. You can fix this with a
 should statement, like this:

 $browser.contains_text(rubyforge.org).should != nil # contains_text
 returns nil if no match is found...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Clicking a JavaScript image button

2009-01-15 Thread Oded

Hello all,
I'm fairly new to Watir, I'm trying to click on a certain image button
with no success.
My code looks like this:
require watir
ie = Watir::new
ie.goto(host)
ie.image(:id, 'btnLogin_imgButton').fire_event(OnMouseDown)
ie.image(:id, 'btnLogin_imgButton').fire_event(OnMouseUp)
ie.image(:id, 'btnLogin_imgButton').fire_event(OnMouseLeave)
---
The above script gives no error, judging by the Ruby output it runs
and performs its task but the button remains untouched.
I've also tried using a simple .click cmd with no success.
I can see from the source code that there's an event with a checkbox
etc, but I could not figure out a way to work around it.

The relevant source code for the page:
img id=btnLogin_imgButton style=cursor:hand;
onmouseup=btnLogin_OnMouseUp(); onmousedown=btnLogin_OnMouseDown
(); onmouseover=btnLogin_OnMouseOver();
onmouseleave=btnLogin_OnMouseLeave(); /
span style=display:none;input id=btnLogin_IsEnable
type=checkbox name=btnLogin$IsEnable checked=checked //span
script type=text/javascript
var IsEnable = document.getElementById( 'btnLogin_IsEnable' );
function btnLogin_OnMouseOver()
{
if(document.getElementById( 'btnLogin_IsEnable').checked)
event.srcElement.src='Images/New/buttons/login/
btn_login_over.png';
else
event.srcElement.src='Images/New/buttons/login/
btn_login_disabled.png';
}
function btnLogin_OnMouseLeave()
{
if(document.getElementById( 'btnLogin_IsEnable').checked)

event.srcElement.src='Images/New/buttons/login/btn_login.png';
else
event.srcElement.src='Images/New/buttons/login/
btn_login_disabled.png';
}
function btnLogin_OnMouseDown()
{
if (event.button == 1)
{
if(document.getElementById( 
'btnLogin_IsEnable').checked)
event.srcElement.src='Images/New/buttons/login/
btn_login_click.png';
else
event.srcElement.src='Images/New/buttons/login/
btn_login_disabled.png';
}
}
function btnLogin_OnMouseUp()
{
if (event.button == 1)
{
if(document.getElementById( 
'btnLogin_IsEnable').checked)
{

event.srcElement.src='Images/New/buttons/login/btn_login.png';
Login();
}
else
event.srcElement.src='Images/New/buttons/login/
btn_login_disabled.png';
}
}

function btnLogin_None () {}

var btnLogin = new function() { var img = document.getElementById
('btnLogin_imgButton'); this.ActiveImage = 'Images/New/buttons/login/
btn_login.png';
this.SelectedImage = 'Images/New/buttons/login/btn_login_click.png';
this.OverImage = 'Images/New/buttons/login/btn_login_over.png';
this.DisabledImage = 'Images/New/buttons/login/
btn_login_disabled.png';
this.Hide = function() { img.style.display='none'; };
this.Show = function() { img.style.display='inline'; };
this.Disable = function() { img.src=this.DisabledImage;
document.getElementById('btnLogin_IsEnable').checked=false;};
this.Enable = function() { img.src=this.ActiveImage;
document.getElementById('btnLogin_IsEnable').checked=true;};
};
document.getElementById('btnLogin_imgButton').src =
document.getElementById('btnLogin_IsEnable').checked? 'Images/New/
buttons/login/btn_login.png':'Images/New/buttons/login/
btn_login_disabled.png';

/script


Any kind of help would be appreciated, 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 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Test Results output capturing

2009-01-15 Thread JArkelen

http://wiki.openqa.org/display/WTR/HTML+report+class

On Jan 15, 7:53 am, Jagdeep Jain jagdeep.j...@gmail.com wrote:
 I got it through Rspec:
 spec usingrspec.rb --format html  testresult.html

 On Jan 15, 11:31 am, Jagdeep Jain jagdeep.j...@gmail.com wrote:

  I want to populate Watir results to HTML format. Is there any way to
  do this?
  Or is there any way to have all 'puts' goes to HTML file?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Code hangs after a div click

2009-01-15 Thread zeng0...@gmail.com

I have the following code:

$browser.link(:text, Media).click
$browser.link(:text, Content Manager).click
Watir::Waiter.wait_until { $browser.text.include? tag all items }
$browser.div(:class, collection-container-scroller).table
(:index, 1)[1][1].div(:class,collection-entry-title-thumb-
compact).click
puts(after click the collection)

It did click the div, but seems after the click, the code hangs and
the next line never gets executed. I also tried irb, it's the same,
after click the div, the irb command line never comes back, I have to
use Ctrl-C to stop it. Does anyone have idea about this?

Thanks in advance!

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



[wtr-general] Re: After Updating ruby version from 1.8.4 to 1.8.6 and watir gem version 1.5.1.1192 to 1.5.1.1230 , am getting error with require command

2009-01-15 Thread Bret Pettichord

1. somehow you did not actually install watir.
2. you should use watir 1.6.2. it is better.

bret

Rahil wrote:
 Hi Guys,

  Am using watir for quite some time with ruby version 1.8.4 and watir
 gem version 1.5.1.1192. Till now it was working fine for me with this
 version but just now i have upgraded my ruby to 1.8.6 and watir gem to
 1.5.1.1230 which also supports firefox. Now am done with my
 installation but when as i try to execute any of my watir test ,
 getting error  LoadError: no such file to load -- watir
 from (irb):1:in `require'
 from (irb):1 

 I tried the same in irb require 'watir' , here also getting same
 error for both in IE and Firefox. Is this problem with latest version
 or I need to do something more to get start with latest version.


 Cheers
 Amit

 
   


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



[wtr-general] Drag and Drop with widgets

2009-01-15 Thread Moochie

Does anyone know how to move widgets on a page?

The class is ui-sortable.

I've search all over and I'm unable to find any helpful information
about drag and drop.


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



[wtr-general] Re: Drag and Drop with widgets

2009-01-15 Thread Paul Rogers

Ive been working on getting this done. Do you know what library is being used?

Paul

On Thu, Jan 15, 2009 at 3:22 PM, Moochie dduph...@redbrickhealth.com wrote:

 Does anyone know how to move widgets on a page?

 The class is ui-sortable.

 I've search all over and I'm unable to find any helpful information
 about drag and drop.


 


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



[wtr-general] Re: Code hangs after a div click

2009-01-15 Thread Michael Hwee


Try click_no_wait()



- Original Message 
From: zeng0...@gmail.com zeng0...@gmail.com
To: Watir General watir-general@googlegroups.com
Sent: Thursday, January 15, 2009 11:20:10 AM
Subject: [wtr-general] Code hangs after a div click


I have the following code:

$browser.link(:text, Media).click
$browser.link(:text, Content Manager).click
Watir::Waiter.wait_until { $browser.text.include? tag all items }
   $browser.div(:class, collection-container-scroller).table
(:index, 1)[1][1].div(:class,collection-entry-title-thumb-
compact).click
puts(after click the collection)

It did click the div, but seems after the click, the code hangs and
the next line never gets executed. I also tried irb, it's the same,
after click the div, the irb command line never comes back, I have to
use Ctrl-C to stop it. Does anyone have idea about this?

Thanks in advance!


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



[wtr-general] Watir scripts do not run when screensaver activates on PC

2009-01-15 Thread Misty M. Collins
I have beenbe running watir/rspec scripts on various machines. My scripts work 
great! However, when the scripts are ran on a virtual machine and the 
connection is closed but still running, the scripts do not work efficiently. In 
other words,when I close the virtual machine without logging off or run the 
scripts with a screen saver running, the scripts do not find certain buttons. 
The scripts do finish running. Has anyone had a problem with running watir 
scripts when they allowed a screen saver to pop up or closed down a virtual 
machine? (yes, I know that I can change the screensaver settings, and or not 
disconnect from VM.) I would like to know if anyone has ran into this problem 
and if so, what did you do to fix?

Thanks.
M



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



[wtr-general] Re: button.Click_No_Wait only highlights the button, does not click

2009-01-15 Thread Bon

I installed JDK6, NetBeans 6.5, Ruby one-click installer(1.8.6-27).
When I clicked button, popup does not pop.
I uninstalled ruby1.8.6-27 and re-installed ruby1.8.6-26.exe as
administrator. Popup works fine for me now.
1. Uninstall ruby1.8.6-27 and re-install ruby1.8.6-26.exe
2. Open DOS command prompt, C:gem update --system
3. C:gem install watir
4. C:\Documents and Setting\administrator\gem install watir
5. Open Internet Explore7  Tools  Internet OptionAdvanced TabCheck
Allow active content...

Good Luck.

On Dec 18 2008, 4:34 pm, Michael Hwee michael_h...@yahoo.com wrote:
 Ok, please let us know the outcome.



 - Original Message 
 From: HAHAHA windchillfigh...@gmail.com
 To:WatirGeneral watir-general@googlegroups.com
 Sent: Thursday, December 18, 2008 12:50:34 PM
 Subject: [wtr-general] Re: button.Click_No_Wait only highlights the 
 button,doesnotclick

 I have tried to set IE to default, but itnotwork. Now I am trying to
 reinstall ruby andwatir.

 On Dec 18, 11:34 am, Michael Hwee michael_h...@yahoo.com wrote:
  First, go to your internet options and reset all your settings to default.

  On vista with IE7, check off the Protected Mode.

  Michael

  - Original Message 
  From: HAHAHA windchillfigh...@gmail.com
  To:WatirGeneral watir-general@googlegroups.com
  Sent: Wednesday, December 17, 2008 12:49:43 PM
  Subject: [wtr-general] Re: button.Click_No_Wait only highlights the 
  button,doesnotclick

  I tried, even change the security of IE to Low, but the click_no_wait
  still cannot click the button.
  Now I just want to know what's the problem. Is it my IE's problem or
  Ruby's problem?

  On Dec 17, 11:53 am, Michael Hwee michael_h...@yahoo.com wrote:
   Come and think of that, have you ever got successful dismissing any 
   otherpopup?

   If I were you, I would be checking the browser configuration settings.

   Michael

   - Original Message 
   From: Fish hhfish...@hotmail.com
   To:WatirGeneral watir-general@googlegroups.com
   Sent: Tuesday, December 16, 2008 5:21:33 PM
   Subject: [wtr-general] Re: button.Click_No_Wait only highlights the 
   button,doesnotclick

   I use the ruby186-26,but still cannothandle thepopup...Just only
   block at the commandline.
  Doessomeone kindly do me a favor to provide code which can handle the
   modaldialog?I very appreciate it.
   I have tried below, but it doestn't work.
   @ie.button(:value, New).click_no_wait #popup a modaldialog, by the
   methodshowmodaldialog
   sleep(3)
   hwnd = @ie.enabled_popup(10)
   @ie1 = @ie.modal_dialog(:title, 'RFQ')

   The error like this:
   c:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/lib/watir/waiter.rb:
   59:in `wait
   _until': Timed out after 10.032 seconds.
   (Watir::Exception::TimeOutException)

   On Dec 16, 7:53 am, HAHAHA windchillfigh...@gmail.com wrote:
I tried. The click_no_wait still cannot click the button. I think
maybe it is really the configure problem.

I use XP SP3, ruby186-27, watir1.6.2. Do you think some earlier
version will be better? I know some programs cannot run in current
version, like rubyscript2exe.rb.

On Dec 16, 3:49 am, pramod D petkar.pra...@gmail.com wrote:

 Hi,

 I worked with your code and it is working fine, Only thing you need 
 to do is
 introduce sleep(5) just before clicking the button. It will handle 
 thepop
 up.

 Thanks,
 Pramod

 On Mon, Dec 15, 2008 at 8:57 PM, HAHAHA windchillfigh...@gmail.com 
 wrote:

  Thank you for your code. I test it. But Click_no_wait still cannot
  work. The result shows There's nopopup. 
  Here is the code I used to test. I changed your code to get it.

  require 'watir'
    require 'watir/ie'#

    require 'watir\contrib\enabled_popup' #fafdfs
    require 'watir/dialog'#fafsfasd
    require 'watir/winClicker'#fasfsdfa
    require 'thread'
  def test_001_Login
         $batchCode=0
         # attach a new browser window
             $ie =Watir::IE.attach(:url,about:blank)

         Watir::IE.attach_timeout =10
          $ie.goto('http://www.w3schools.com/js/tryit_view.asp?
  filename=tryjs_alerthttp://www.w3schools.com/js/tryit_view.asp?filename=tryjs_alert')
  # This website only has an alert button, you
  can test using this website.

                 $ie.button(:index,1).click_no_wait
                  begin
                     hwnd = $ie.enabled_popup(5)
                     if(hwnd)
                         popup= WinClicker.new
                         popup.makeWindowActive(hwnd) #Activate the
  window.
                         popup.clickWindowsButton_hwnd(hwnd,OK)
  #Click the OK button
                     end
                 rescue = e
                     puts e
                     puts There is nopopup
                   end
                  end

  test_001_Login

  Can you try it and see 

[wtr-general] Re: Clicking a JavaScript image button

2009-01-15 Thread Oded

I've tried this previously to posting the thread,
this gives the same result as the thing I posted, resulting in no
error nor action.

On Jan 15, 5:00 pm, wesley chen cjq@gmail.com wrote:
 require 'watir'
 ie=Watir::IE.start(your address)
 ie.image(:id,/btnLogin_imgButton/).click

 Thanks.
 Wesley Chen.

 On Thu, Jan 15, 2009 at 8:04 PM, Oded adlersb...@gmail.com wrote:

  Hello all,
  I'm fairly new to Watir, I'm trying to click on a certain image button
  with no success.
  My code looks like this:
  require watir
  ie = Watir::new
  ie.goto(host)
  ie.image(:id, 'btnLogin_imgButton').fire_event(OnMouseDown)
  ie.image(:id, 'btnLogin_imgButton').fire_event(OnMouseUp)
  ie.image(:id, 'btnLogin_imgButton').fire_event(OnMouseLeave)
  ---
  The above script gives no error, judging by the Ruby output it runs
  and performs its task but the button remains untouched.
  I've also tried using a simple .click cmd with no success.
  I can see from the source code that there's an event with a checkbox
  etc, but I could not figure out a way to work around it.

  The relevant source code for the page:
  img id=btnLogin_imgButton style=cursor:hand;
  onmouseup=btnLogin_OnMouseUp(); onmousedown=btnLogin_OnMouseDown
  (); onmouseover=btnLogin_OnMouseOver();
  onmouseleave=btnLogin_OnMouseLeave(); /
  span style=display:none;input id=btnLogin_IsEnable
  type=checkbox name=btnLogin$IsEnable checked=checked //span
  script type=text/javascript
         var IsEnable = document.getElementById( 'btnLogin_IsEnable' );
     function btnLogin_OnMouseOver()
     {
                 if(document.getElementById( 'btnLogin_IsEnable').checked)
                 event.srcElement.src='Images/New/buttons/login/
  btn_login_over.png';
                 else
                         event.srcElement.src='Images/New/buttons/login/
  btn_login_disabled.png';
     }
     function btnLogin_OnMouseLeave()
     {
                 if(document.getElementById( 'btnLogin_IsEnable').checked)

   event.srcElement.src='Images/New/buttons/login/btn_login.png';
                 else
                         event.srcElement.src='Images/New/buttons/login/
  btn_login_disabled.png';
     }
     function btnLogin_OnMouseDown()
     {
         if (event.button == 1)
         {
                         if(document.getElementById(
  'btnLogin_IsEnable').checked)

   event.srcElement.src='Images/New/buttons/login/
  btn_login_click.png';
                         else

   event.srcElement.src='Images/New/buttons/login/
  btn_login_disabled.png';
         }
     }
     function btnLogin_OnMouseUp()
     {
         if (event.button == 1)
                 {
                         if(document.getElementById(
  'btnLogin_IsEnable').checked)
                 {

   event.srcElement.src='Images/New/buttons/login/btn_login.png';
                                 Login();
             }
                         else

   event.srcElement.src='Images/New/buttons/login/
  btn_login_disabled.png';
                 }
         }

     function btnLogin_None () {}

     var btnLogin = new function() { var img = document.getElementById
  ('btnLogin_imgButton'); this.ActiveImage = 'Images/New/buttons/login/
  btn_login.png';
  this.SelectedImage = 'Images/New/buttons/login/btn_login_click.png';
  this.OverImage = 'Images/New/buttons/login/btn_login_over.png';
  this.DisabledImage = 'Images/New/buttons/login/
  btn_login_disabled.png';
  this.Hide = function() { img.style.display='none'; };
  this.Show = function() { img.style.display='inline'; };
  this.Disable = function() { img.src=this.DisabledImage;
  document.getElementById('btnLogin_IsEnable').checked=false;};
  this.Enable = function() { img.src=this.ActiveImage;
  document.getElementById('btnLogin_IsEnable').checked=true;};
  };
  document.getElementById('btnLogin_imgButton').src =
  document.getElementById('btnLogin_IsEnable').checked? 'Images/New/
  buttons/login/btn_login.png':'Images/New/buttons/login/
  btn_login_disabled.png';

  /script
  

  Any kind of help would be appreciated, 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 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Code hangs after a div click

2009-01-15 Thread wesley chen
What's the detail information about your div? When the div is clicked, what
will happen?

Thanks.
Wesley Chen.


On Fri, Jan 16, 2009 at 9:14 AM, Michael Hwee michael_h...@yahoo.comwrote:



 Try click_no_wait()



 - Original Message 
 From: zeng0...@gmail.com zeng0...@gmail.com
 To: Watir General watir-general@googlegroups.com
 Sent: Thursday, January 15, 2009 11:20:10 AM
 Subject: [wtr-general] Code hangs after a div click


 I have the following code:

$browser.link(:text, Media).click
$browser.link(:text, Content Manager).click
Watir::Waiter.wait_until { $browser.text.include? tag all items }
   $browser.div(:class, collection-container-scroller).table
 (:index, 1)[1][1].div(:class,collection-entry-title-thumb-
 compact).click
puts(after click the collection)

 It did click the div, but seems after the click, the code hangs and
 the next line never gets executed. I also tried irb, it's the same,
 after click the div, the irb command line never comes back, I have to
 use Ctrl-C to stop it. Does anyone have idea about this?

 Thanks in advance!


 


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



[wtr-general] Re: Clicking a JavaScript image button

2009-01-15 Thread wesley chen
I don't know what will happen when the image button is triggered.

Maybe it will succeed to separate the Javascript.
such as:
require 'watir'
ie=Watir::IE.start(your address)
ie.image(:id,/btnLogin_imgButton/).fire_event(onmouseup) # or
***.fire_event(onmousedown) or...
ie.image(:id,/btnLogin_imgButton/).click

Thanks.
Wesley Chen.


On Fri, Jan 16, 2009 at 3:29 AM, Oded adlersb...@gmail.com wrote:


 I've tried this previously to posting the thread,
 this gives the same result as the thing I posted, resulting in no
 error nor action.

 On Jan 15, 5:00 pm, wesley chen cjq@gmail.com wrote:
  require 'watir'
  ie=Watir::IE.start(your address)
  ie.image(:id,/btnLogin_imgButton/).click
 
  Thanks.
  Wesley Chen.
 
  On Thu, Jan 15, 2009 at 8:04 PM, Oded adlersb...@gmail.com wrote:
 
   Hello all,
   I'm fairly new to Watir, I'm trying to click on a certain image button
   with no success.
   My code looks like this:
   require watir
   ie = Watir::new
   ie.goto(host)
   ie.image(:id, 'btnLogin_imgButton').fire_event(OnMouseDown)
   ie.image(:id, 'btnLogin_imgButton').fire_event(OnMouseUp)
   ie.image(:id, 'btnLogin_imgButton').fire_event(OnMouseLeave)
   ---
   The above script gives no error, judging by the Ruby output it runs
   and performs its task but the button remains untouched.
   I've also tried using a simple .click cmd with no success.
   I can see from the source code that there's an event with a checkbox
   etc, but I could not figure out a way to work around it.
 
   The relevant source code for the page:
   img id=btnLogin_imgButton style=cursor:hand;
   onmouseup=btnLogin_OnMouseUp(); onmousedown=btnLogin_OnMouseDown
   (); onmouseover=btnLogin_OnMouseOver();
   onmouseleave=btnLogin_OnMouseLeave(); /
   span style=display:none;input id=btnLogin_IsEnable
   type=checkbox name=btnLogin$IsEnable checked=checked //span
   script type=text/javascript
  var IsEnable = document.getElementById( 'btnLogin_IsEnable' );
  function btnLogin_OnMouseOver()
  {
  if(document.getElementById(
 'btnLogin_IsEnable').checked)
  event.srcElement.src='Images/New/buttons/login/
   btn_login_over.png';
  else
  event.srcElement.src='Images/New/buttons/login/
   btn_login_disabled.png';
  }
  function btnLogin_OnMouseLeave()
  {
  if(document.getElementById(
 'btnLogin_IsEnable').checked)
 
event.srcElement.src='Images/New/buttons/login/btn_login.png';
  else
  event.srcElement.src='Images/New/buttons/login/
   btn_login_disabled.png';
  }
  function btnLogin_OnMouseDown()
  {
  if (event.button == 1)
  {
  if(document.getElementById(
   'btnLogin_IsEnable').checked)
 
event.srcElement.src='Images/New/buttons/login/
   btn_login_click.png';
  else
 
event.srcElement.src='Images/New/buttons/login/
   btn_login_disabled.png';
  }
  }
  function btnLogin_OnMouseUp()
  {
  if (event.button == 1)
  {
  if(document.getElementById(
   'btnLogin_IsEnable').checked)
  {
 
event.srcElement.src='Images/New/buttons/login/btn_login.png';
  Login();
  }
  else
 
event.srcElement.src='Images/New/buttons/login/
   btn_login_disabled.png';
  }
  }
 
  function btnLogin_None () {}
 
  var btnLogin = new function() { var img = document.getElementById
   ('btnLogin_imgButton'); this.ActiveImage = 'Images/New/buttons/login/
   btn_login.png';
   this.SelectedImage = 'Images/New/buttons/login/btn_login_click.png';
   this.OverImage = 'Images/New/buttons/login/btn_login_over.png';
   this.DisabledImage = 'Images/New/buttons/login/
   btn_login_disabled.png';
   this.Hide = function() { img.style.display='none'; };
   this.Show = function() { img.style.display='inline'; };
   this.Disable = function() { img.src=this.DisabledImage;
   document.getElementById('btnLogin_IsEnable').checked=false;};
   this.Enable = function() { img.src=this.ActiveImage;
   document.getElementById('btnLogin_IsEnable').checked=true;};
   };
   document.getElementById('btnLogin_imgButton').src =
   document.getElementById('btnLogin_IsEnable').checked? 'Images/New/
   buttons/login/btn_login.png':'Images/New/buttons/login/
   btn_login_disabled.png';
 
   /script
   
 
   Any kind of help would be appreciated, 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 

[wtr-general] Re: Is it possible to close the browser if the page is not loaded in given time?

2009-01-15 Thread Prince3105

Hi Experts,

Please advise me, to avoid this issue can i change the ie-class file
like below,

def goto(url)
  @ie.navigate(url)
  sleep 20
  return @down_load_time
end

just i changed the wait into sleep 20, will it work? My intention is
browser should wait upto 20 seconds, still application is not loaded,
the instance should be closed and the other instance should be
started. Please post your valuable suggestion.

Thanks.


On Jan 13, 2:50 pm, Prince3105 prince3...@gmail.com wrote:
 Hi Experts,

 I am a newbie to Watir, am using below versions

 Ruby  - 1.8.6-26 Final Release
 Watir  - Watir 1.6.0

 I already post a question related to this topic. In continuous test
 execution new page got hanged often  and test gets fail. So please
 give me a solution , If a page is not loaded in a given time like 20
 seconds, can we close the browser create a new instance and continue
 the process?

 Thanks

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