[wtr-general] IE7 Popup handling

2009-03-02 Thread Abhishek

Is there any simple way to handle IE7 popup Choose Digital
Certificate ?

I need a generic popup handling library which can handle all kind of
Javascript popups in IE7.

Thanks in advanced

- Abhishek

--~--~-~--~~~---~--~~
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: IE7 Popup handling

2009-03-02 Thread kiran yajamanyam
Hi Abhishek,

Please try this below piece of code. Need to install Autoit software.

def check_for_popups
autoit = WIN32OLE.new('AutoItX3.Control')
autoit.Opt(WinTitleMatchMode, 3)

puts Launched the global pop-up handler
loop do

# Look for window with given title. Give up after 1 second.
ret = autoit.WinWait('Choose Digital Certificate', '', 1)

# If window found, send appropriate keystroke (e.g. {enter}, {Y}, {N}).
if ret==1
   then
   autoit.WinActivate('Choose Digital Certificate')
   sleep(1)
   autoit.Send('{enter}')
end

Regards,
Kiran Y
On Mon, Mar 2, 2009 at 3:33 PM, Abhishek kulkarni.abhishe...@gmail.comwrote:


 Is there any simple way to handle IE7 popup Choose Digital
 Certificate ?

 I need a generic popup handling library which can handle all kind of
 Javascript popups in IE7.

 Thanks in advanced

 - Abhishek

 


--~--~-~--~~~---~--~~
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: IE7 Popup handling

2009-03-02 Thread Abhishek Kulkarni
Hi Kiran,

Thanks for your quick response.

I want to handle this Pop up using Watir only. Can I run this script in
Ruby?

Thanks
Abhishek

On Mon, Mar 2, 2009 at 3:51 PM, kiran yajamanyam
kiranyajaman...@gmail.comwrote:


 Hi Abhishek,

 Please try this below piece of code. Need to install Autoit software.

 def check_for_popups
 autoit = WIN32OLE.new('AutoItX3.Control')
 autoit.Opt(WinTitleMatchMode, 3)

 puts Launched the global pop-up handler
 loop do

 # Look for window with given title. Give up after 1 second.
 ret = autoit.WinWait('Choose Digital Certificate', '', 1)

 # If window found, send appropriate keystroke (e.g. {enter}, {Y}, {N}).
 if ret==1
then
autoit.WinActivate('Choose Digital Certificate')
sleep(1)
autoit.Send('{enter}')
 end

 Regards,
 Kiran Y

 On Mon, Mar 2, 2009 at 3:33 PM, Abhishek kulkarni.abhishe...@gmail.comwrote:


 Is there any simple way to handle IE7 popup Choose Digital
 Certificate ?

 I need a generic popup handling library which can handle all kind of
 Javascript popups in IE7.

 Thanks in advanced

 - Abhishek




 


--~--~-~--~~~---~--~~
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: IE7 Popup handling

2009-03-02 Thread Abhishek Kulkarni
h.

Something is wrong I did not receive any error but unable to click OK
button.

I am doing it in the following way ...

My.rb
-
require 'win32/process'
require 'watir'
ie=Watir::IE.new

link = Specified-URL
ie.goto(link)


  @pid = Process.create(
  :app_name   = 'ruby clicker.rb',
  :creation_flags  = Process::DETACHED_PROCESS
  ).process_id

at_exit{ Process.kill(9,@pid) }


AND

clicker.rb
-
require 'win32ole'

autoit = WIN32OLE.new('AutoItX3.Control')
autoit.Opt(WinTitleMatchMode, 3)

puts Launched the global pop-up handler
loop do
  # Look for window with given title. Give up after 1 second.
  ret = autoit.WinWait('Choose a digital certificate', '', 1)
  # If window found, send appropriate keystroke (e.g. {enter}, {Y}, {N}).
  if ret==1 then
autoit.WinActivate('Choose a digital certificate')
sleep(1)
autoit.Send('{enter}')

What could be the wrong?

Thanks
Abhishek



On Mon, Mar 2, 2009 at 4:48 PM, kiran yajamanyam
kiranyajaman...@gmail.comwrote:

 Yes u can run this script in Ruby. Let me know if you face any issue while
 executing this code.

 Regards,
 Krian Y



 On Mon, Mar 2, 2009 at 4:40 PM, Abhishek Kulkarni 
 kulkarni.abhishe...@gmail.com wrote:

 Hi Kiran,

 Thanks for your quick response.

 I want to handle this Pop up using Watir only. Can I run this script in
 Ruby?

 Thanks
 Abhishek


 On Mon, Mar 2, 2009 at 3:51 PM, kiran yajamanyam 
 kiranyajaman...@gmail.com wrote:


 Hi Abhishek,

 Please try this below piece of code. Need to install Autoit software.

 def check_for_popups
 autoit = WIN32OLE.new('AutoItX3.Control')
 autoit.Opt(WinTitleMatchMode, 3)

 puts Launched the global pop-up handler
 loop do

 # Look for window with given title. Give up after 1 second.
 ret = autoit.WinWait('Choose Digital Certificate', '', 1)

 # If window found, send appropriate keystroke (e.g. {enter}, {Y},
 {N}).
 if ret==1
then
autoit.WinActivate('Choose Digital Certificate')
sleep(1)
autoit.Send('{enter}')
 end

 Regards,
 Kiran Y

 On Mon, Mar 2, 2009 at 3:33 PM, Abhishek 
 kulkarni.abhishe...@gmail.comwrote:


 Is there any simple way to handle IE7 popup Choose Digital
 Certificate ?

 I need a generic popup handling library which can handle all kind of
 Javascript popups in IE7.

 Thanks in advanced

 - Abhishek










 


--~--~-~--~~~---~--~~
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: Very slow typing speed for firefox 2 : watir 1.6.2

2009-03-02 Thread Cliff Cyphers

Late to the thread but wanted to add something recently observed while
running firefox through strace.  It appears there are some flow
control issues which may explain the slow typing speed.  It's also
been noted with some puts in the read_socket method the problem isn't
as severe.

While it may be in the JSSH code it may require updates on both sides
and there's always a chance it's 100% on the ruby side.  I'll be
digging into both as well over the next week or so.  From the ruby
side maybe we can set some fcntl flags (looks unlikely through).

system call failure from strace:
read(3, 0x8d165d4, 4096)= -1 EAGAIN (Resource
temporarily unavailable)


On Mon, Mar 2, 2009 at 9:38 AM, Cliff cliff.cyph...@gmail.com wrote:



 -- Forwarded message --
 From: Charley Baker charley.ba...@gmail.com
 Date: Nov 12 2008, 10:24 am
 Subject: Very slow typing speed for firefox 2 : watir 1.6.2
 To: Watir General


 I'm seeing this happen with one of the people I'm working with, slow
 meaning
 almost 1sec/character in this case. He's running firefox on linux. My
 guess
 is that it's due to jssh, but it's hard to tell, I'll poke around and
 see if
 I can find out more.
 What OS/FireFox version and jssh addon are you using?

 Thanks,

 Charley

 On Wed, Nov 12, 2008 at 8:43 AM, Bret Pettichord
 b...@pettichord.comwrote:



 Natasha wrote:
  I was able to install and run my test against IE using latest Watir.
  But I found that the typing speed is very slow for firefox.

  For e.g. following command executed very slowly:

  $ie.text_field(:id,txtLine2).set(this is text field 2)

  Is this a known issue? Is there anyway we can speep this up somehow?

 Many of us have seen this problem, but it seems to show up
 intermittently and we don't really know the cause.

 Bret

--~--~-~--~~~---~--~~
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: [forum] Tagging of subjects

2009-03-02 Thread Bret Pettichord

I would just be happy if everybody made sure the subject line was 
appropriate. Some people reply to threads with new topics, which is very 
confusing.

Bret

JArkelen wrote:
 Hi all,

 I like this forum very much and have found a lot of information which
 solved the problems I had (the bad win32 gem as most recent example).
 However, the unstructured nature of Google Groups makes the forum very
 unorganized in my opinion. I think we could make it much more
 organized by tagging the subjects of topics, like fro example this:

 [installation] Firewatir installation error
 [popup] How to click on popup windows
 [features] Should Watir support Chrome browser?

 What do you think, would this help organize this forum a bit better?

 Cheers,
 John
 
   


--~--~-~--~~~---~--~~
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: contains_text compatibility

2009-03-02 Thread Bret Pettichord

We fixed several bugs in this area, but apparently missed one.

There is really no standard as to what the right way is to convert html 
to text, and the raw methods in Firefox and IE work differently. We've 
patched up some differences.

Frankly, I think using browser.contains_text is a pretty unreliable 
testing strategy. You are usually much better off focusing on a specific 
part of the html for your validation.

Bret


John Fitisoff wrote:
 I'm running into a problem with Browser#text. I'd done an integration with 
 1.6.2 a month or two back and thought things were working OK. But I ran a 
 test suite yesterday using Firefox and ran into some failures that I wasn't 
 seeing on the IE side (5 out of 350). These were all related to attempts to 
 parse the page text. If I run this script on the IE side, I get a non-nil 
 value when calling contains_text:

 b = Watir::Browser.new
 b.goto('www.google.com')
 b.text_field(:index, 1).set 'foo'
 b.button('Google Search').click
 b.contains_text(The term foobar, along with foo, bar, and baz, is a common 
 placeholder name)

 But if I run the same script using Firefox the contains_text method evaluates 
 to nil. It looks like this is happening because there are extra spaces in the 
 Firefox output. If I add an additional space to the string between a and 
 common then I start getting the expected non-nil value on the Firefox side 
 when I use contains_text.

 Is this a known issue?

 Thanks

 John



   

 
   


--~--~-~--~~~---~--~~
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: Object as parameter

2009-03-02 Thread SQAPro

Having had the weekend to ponder this, it occurs to me, am I guilty of
slipping into pre-oop thinking? by trying to create what amount to
'functions' instead of teaching objects how to act on themselves?

Should I be doing something like subclassing the watir browser class
and adding my methods to that?? perhaps have it take the URL of the
login page, the username, and password as parameters, and then just
send it a message tot he browser object something along the lines of

 brow.login_ess_user(login_url, user, pass)

On Feb 27, 5:00 pm, sqa...@gmail.com wrote:
 I'm having a similar issue, I'm pretty sure it's scope related, but I
 can't wrap my head around what I need to do to fix it.   My longterm
 intent is to move a bunch of frequently called methods, such as
 logging in a user, off into a seperate file (or module?) but my first
 attempt at this is failing.  The problem seems to center around my
 trying to pass the browser instance to the method, which I should
 think would be possible, but I'm getting the error below:

  test_login_user(Ess_Employee_Tests):
 NoMethodError: undefined method `goto' for nil:NilClass

 Here's a somewhat abridged version of the code (removing most of the
 validation, all of which is working)

 #-=-=-=-=-=-=-=
 require 'watir'
 require 'watir/testcase'
 require 'example_logger1'
 require 'CLReport.class'

 Watir::Browser.default = 'ie'

 #  GlobalConstants
 $employee_userid = 'hallb'
 $employee_password = 'test'
 $employee_name = 'Bob T. Hall'
 $ess_site = 'http://odo-qas1/SelfService'
 $ess_loginpage = $ess_site + '/SelfServiceLogin.aspx'

 #Create a Report file
 $results = CLReport.new()
 $testReport = $results.createReport('c:\\QAReports\\ess-smoketest')
 #Create a Logfile
 logfileprefix = 'ess_Employee_log'
 $logger = LoggerFactory.start_xml_logger(logfileprefix)

 #  method for logging a user into the site   this is the method
 I can't get to work...
 #
 def ess_login(b, userid, password)
   b.goto $ess_loginpage
   b.text_field(:id, 'UserId').set userid
   b.text_field(:id, 'Password').set password
   b.button(:id, 'Login').click
 end

 class ESS_Employee_Tests  Watir::TestCase

   #initialization stuff
   def start
     #Open a browser
     @b = Watir::Browser.new
     @b.set_logger($logger)
   end

   def test_login_page  #tests content of user login page
     #call start method
     start

     $logger.log('Beginning of testcase set for ESS Employee actions')
     $logger.log('Beginning of test_login_page)')
     $logger.log('Step: call and validate login page')
     @b.goto $ess_loginpage
     $logger.log('action: browser goto ' + $ess_loginpage)
     #Check page contents as expected
     $logger.log('checking contents of login page')

     # is the word login on the page?
     if @b.text.include?('Login')
       $results.addtoReport($testReport, 'Page text contains phrase:
 Login', 'PASSED', 'phrase: Login found')
       $logger.log('found text login on page')
     else
       $results.addtoReport($testReport, 'Page text contains phrase:
 Login', 'FAILED', 'phrase: Login not found on page')
     end

     # snip for brevity I've removed a bunch more like the one above,
 that test content of the page, all of which is working

   end #end of test_Login_Page

   def test_login_user
       $logger.log('Calling ess_login from test_login user')
       ess_login(@b, $employee_id, $employee_password)

     # snip more validation and assertions follow for the page seen
 once the user is logged in

   end # end of test_login_user
 end #end of class Ess_Employee_Tests

 class ZZZ_Cleanup_And_Publish_Report  Watir::TestCase
   def test_finished
     $logger.log('about to close test report')
     $results.finishReport($testReport)
     $logger.log('after test report closed')
     $logger.end_log #needed for xml log only?
   end #end of test_finished
 end #end of class ZZZ_Cleanup_And_Publish_Report

 Notes:
  * all the globals is ugly.. need to find a better way, either via
 seperate ruby file, or reading from some spreadsheet or config file to
 allow test to be more data driven down the road.
  * I expect to add a whole additional class for the Manager action
 tests (approving employee requests etc), which is why the ess_login
 method isn't just inside the test case class.
  * still fumbling around looking for best way to report the results
 but the CLReport is spiffy enough to do for now
  * Also not sure (with way I'm doing my validations, and not using
 'assert') that there's value to using Watir/testcase
  * tons of best practice, what works well in real life large projects
 etc questions, but for the moment I just need to get some scripts
 working to make the boss happy..  will see perfection soon, but not
 this instant.

 On Feb 25, 9:02 am, Tiffany Fodor tcfo...@comcast.net wrote:



  I think your problem is with the scope of the variable @my_workbook
  because it's a member of a class now.  I recommend finding a good Ruby
  resource that describes the various 

[wtr-general] Re: Data scraping using WATIR

2009-03-02 Thread Charley Baker
There's also ScrubyT which is more of a scraping library with underlying web
drivers, one of them being Firewatir. Google it and take a gander.


Charley Baker
blog: http://charleybakersblog.blogspot.com/
Lead Developer, Watir, http://wtr.rubyforge.org
QA Architect, Gap Inc Direct


On Mon, Mar 2, 2009 at 11:48 AM, sqa...@gmail.com wrote:


 you can always use the .html method of the browser object to get the
 entire page contents, and then something like a regular expression  or
 substring methods to extract text from between known starting/ending
 text.

 Most of that would be done with standard Ruby string handing methods
 I'd expect

 You'd likely have to develop your Ruby skills a bit..  I'd recommend a
 book like 'Everyday Scripting with Ruby' for that.

 On Mar 2, 5:06 am, RASPool rich...@pool.com wrote:
  I am playing around with Watir and have had some pretty good results
  so far, but I was wondering if there is any functionality to capture
  data once you arrive at a particular page.  For example, I want to
  browse to the weather network site, select the weather for my home
  town and then extract the current temperature on the page.  And then
  I’d cron it to run every day at noon and I’d compile a report that
  would tell me the noon temp every day.
 


--~--~-~--~~~---~--~~
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: Gem Recall Notice: win32-api

2009-03-02 Thread Bret Pettichord

Thanks for the report and for taking this up with the rubygems 
developers. I just read your recent posts there, but don't normally 
follow that list. Please let me know if involvement will help.

Sincerely,

Bret top-posting windoze bastard Pettichord

Daniel Berger wrote:

 On Feb 13, 10:19 am, Bret Pettichord b...@pettichord.com wrote:
   
 For some background on this problem, please see Daniels recent 
 statement.http://djberg96.livejournal.com/162898.html
 

 To make matters worse, Charley Baker has spotted a problem with Hoe
 causing Rubygems to download the wrong precompiled binary:

 ==
 Well, ok. So I've figured out how to reproduce it, seems it's hoe that
 actually causing an issue.
 - create a basic gemspec
Gem::Specification.new do |s|
 
 s.add_dependency 'user-choices'  #could be any hoe generated gem
 s.add_dependency 'win32-process', '=0.5.5'
 ...
 end

 - build the gem
 - install it

 When it tries install the win32-api library it grabs the wrong
 version. Add the dependency later and it works for this basic example,
 but I'm assuming dependencies might not be ordered, since in the
 actual Watir gemspec, we have a dependency on common-watir after the
 win32 dependency calls; common watir is built with hoe as are some
 it's dependencies - user-choices and it's required libs in our case.
 ==

 For now I've decided to go ahead and just delete the mswin32_80 binary
 from RubyForge so that the mswin32_60 gem (the one compatible with the
 one-click) is the only binary gem posted.

 I've posted Charley's email to the rubygems-developers mailing list to
 see if anyone knows how exactly Hoe is causing problems.

 Sorry for all the trouble folks.

 Regards,

 Dan

 
   


--~--~-~--~~~---~--~~
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] Add date

2009-03-02 Thread Prince3105

Hi experts,

I am a learner of Watir , my scenario is to collect the date value
from a text_field then add one day or subtract one day from that day.

Details are given below.

i get the date from text_field as a string in dd-mmm- format(02-
MAR-2009).

Then i have to do add or subtract days with the string, then i have to
validate the new date.

below code am using to get the output. But am sure this may not be a
standard coding.

def date_validation( source, count, operation)
start_date = source
date = Date.strptime(start_date, '%d-%b-%Y')

if operation == a or operation==A
final_date = date + count
  end
  if operation == d or operation==D
final_date = date - count
  end
  final_date = #{final_date.day}-#{final_date.month}-#
{final_date.year}
  return final_date
  end

  date_validation(offer_approval_date, 1, A)


The above code returns the value as dd-mm- format, but i need the
output as
 dd-mmm- format(03-MAR-2009).

So please modify my code if required and give me a nice solution.

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