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

2009-01-16 Thread jensen2525

I ran into this issue and have been able to resolve what was causing
this on Windows XP.  This may not be what's causing it for other folks
but hopefully it will point them in the right direction.

We have an TeamCity server that will execute our tests using Rake on
the build agents running Windows XP.  When my scripts that were
dealing with popups ran on the agents they failed every time with the
same issue described in this thread.

So what I did was take the simple Google sample and run it in a
Command Prompt on the agent directly and it worked fine.  I used the
Command Prompt window and executed my full test case and it ran fine.
I shut down the TeamCity build agent service, and ran their agent
batch files directly (not the service).  I kicked the build off again
and it ran fine this time.

The problem seemed to be related to the Ruby process executing under
the SYSTEM user account.  I stopped running them through the service
and instead as normal batch files in the Startup and they're working
fine now.  It seems like there is an issue related to the
@page_container.eval_in_spawned_process when running under this type
of security setup.  Make sure whatever process is launching Ruby is
running as a normal user account and see if that resolves the problem.


Hope this helps.



On Dec 12 2008, 9:19 am, Bret Pettichord b...@pettichord.com wrote:
 Your code is correct. There is something about your configuration that
 causes this to fail.

 Bret

 HAHAHA wrote:
  I have tried, using this code:

  require 'watir'

  browser = Watir::IE.new
  browser.goto('http://www.google.com')
  browser2 = Watir::IE.attach(:title, /Google/)
  browser2.text_field(:name, 'q').set('Watir')
  browser2.button(:name, 'btnG').click_no_wait

  The click_no_wait still cannot run. Is the code right?

  On Dec 12, 9:58 am, larryni...@gmail.com larryni...@gmail.com
  wrote:

  Pramod, could you show us an example of your code?

  On Dec 11, 11:01 pm, pramod D petkar.pra...@gmail.com wrote:

  Hi Michael,

  Initially i also faced same problem when i use Click_no_wait control was
  going but never clicked it, To come around this initially i opened the IE
  (IE7)with blank page and then, i will attach the browser at the start of 
  the
  script and continue to execute my script as usual and worked correctly. 
  For
  time being you can fallow this turn around method.

  Thanks,
  Pramod
  On Fri, Dec 12, 2008 at 1:46 AM, Michael Hwee 
  michael_h...@yahoo.comwrote:

  That is disappointing.
  I believe that is something like OS and/or configuration issues, rather
  than watir itself.

  Michael

  - Original Message 
  From: larryni...@gmail.com larryni...@gmail.com
  To: Watir General watir-general@googlegroups.com
  Sent: Thursday, December 11, 2008 12:00:00 PM
  Subject: [wtr-general] Re: button.Click_No_Wait only highlights the 
  button,
  does not click

  Sorry, Michael, your code doesn't work either.  It opens the page,
  highlights the button yellow, and then just sits there.  No popup is
  ever launched because it doesn't actually click the button.  Watir
  doesn't report any errors, but it never completes, either.  If I
  change click_no_wait to click!, it does launch the popup, but the
  handle_nextpopup command never executes - it's been sitting here for
  90-120 seconds with the popup open not doing anything.  So, again, to
  summarize: click_no_wait is incapable of firing any events, but click!
  makes the script hang.- 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 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Controlling JavaScript Pop Ups without .click_no_wait

2009-02-12 Thread jensen2525


I ran into a similar issue and was able to work around it by calling
click! instead of click or click_no_wait.  We're not using SproutCore
so this may not be relevant to your issue.

## snip
  # Click on the Export button then Save the file as an
artifact
  export = browser.button(:id, exportButtonId)
  export.click!
  popup_save_file artifact_filename
## end snip

## snip
def popup_save_file(filename, wait_time = 10)
  begin
autoit = WIN32OLE.new(AutoItX3.Control)

# Wait for the File Download dialog
autoit.WinWaitActive(File Download, , wait_time)

# Click on the Save button
autoit.ControlFocus(File Download, , Save)
sleep 1
autoit.Send(S)
autoit.ControlClick(File Download, , Save)

# Wait for the Save As dialog, enter the filename and click
Save
autoit.WinWaitActive(Save As, , wait_time)
autoit.Send(filename)
autoit.ControlClick(Save As, , Save)

# Wait for the Download complete dialog and Close it
autoit.WinWaitActive(Download complete)
autoit.WinClose(Download complete)
  rescue
@@logger.warn Error occurred while saving file: #{$!}
  end
##end snip


Good luck.



On Feb 11, 8:11 pm, Bill Xu xulei8823...@gmail.com wrote:
 Hi
    The Thread.new function seems still could not solve the problem.
 (click_no_wait still could not work for me, the)
 see following simple code:
 code#
 downloadlink  = $ie.link(:text,SAMPLE.CSV)
 thr = Thread.new {
   downloadlink.fire_event(onMouseDown)
   downloadlink.fire_event(onMouseUp)}

 downloadlink.click_no_wait
 save_file(C:\\file.txt)
 code end#
 Note that the link is chosen but not clicked.

 2009/2/11 LFIdnl sraniim...@gmail.com



  Run you part of code in new thread:

  thr = Thread.new {
    your_object.fire_event(onMouseDown)
    your_object.fire_event(onMouseUp)
  }
  sleep(5) #Waiting for end of execution of thread
  #continue your test

  On 26 янв, 23:25, Bill Mosteller w...@greatdecals.com wrote:
   The application situation is that the user is about to discard unsaved
   work.  A dialog box appears titled Windows Internet Explorer saying
   Are you sure you want to delete the selected Email? with buttons
   OK and Cancel.

   I thought my prayers were answered for this when I found:
 http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups

   While it proposes five solutions to the problem, solutions 3 thorugh 5
   require the use of .click_no_wait.  I'm testing a SproutCore
   application, and .click doesn't work, so .click_no_wait doesn't,
    either.  (I'm using .fire_event(onMouseDown) followed by .fire_event
   (onMouseUp) to click on things.

   So I tried solutions 1 and 2 in the article, and while I got both to
   execute without errors in my application, neither approach dismisses
   my modal dialog box.

   Thankis.
   Bill Mosteller
   Eloqua

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