[wtr-general] Re: Working with Ajax and watir

2009-04-20 Thread spike

Hi

i went through the link and did some changes but it didnt work for me
below is the code i'm using to handle the ajax popup. please suggest
the changes required

require 'Watir/ie'
require 'test/unit'
require 'watir/testcase'
require 'win32ole'
require 'watir/contrib/enabled_popup'

class Learntrack  Test::Unit::TestCase
  def test_learntrack1
ie = Watir::IE.start http://192.168.25.10:215/;
ie.maximize()
ie.text_field(:name, Login1$UserName).set(vinay)
ie.text_field(:name, Login1$Password).set(computer)
ie.checkbox(:name, Login1$RememberMe).click
ie.button(:value, Log In).click
ie.link(:href, javascript:__doPostBack
('ctl00$lnkbtnPreferences','')).click
ie.link(:href, http://192.168.25.10:215/ChangeSkin.aspx;).click
ie.button(:name, ctl00$cph$ImageOrange).click
sleep 8
while (!ie.button(:id, btnAppltTheme).exists?)
  puts button exists
ie.button(:id, btnAppltTheme).click
  sleep 2
  popupchecker(ie, Apply Theme)
end
end

#popup
def popupchecker(browser, text)
Timeout::timeout(2) do
  begin
puts popupchecker begins.
puts browser.enabled_popup == #{browser.enabled_popup}
if browser.enabled_popup
  puts popup enabled.
  hwnd = browser.enabled_popup(5)
  puts hwnd.to_s
  w = WinClicker.new
  w.makeWindowActive(hwnd)
  w.clickWindowsButton_hwnd(hwnd, text)
end
rescue Timeout::Error
  puts 'No popup existed.'
end
  end
end
end



On Apr 18, 4:24 am, Chuck van der Linden sqa...@gmail.com wrote:
 You may want to read this 
 thread...http://groups.google.com/group/watir-general/browse_thread/thread/075...

 You need to determine if that's really some kind of popup, (and if so
 what type) or if it's just a div that looks and behaves a bit like a
 popup.

 On Apr 17, 2:09 am, spike vinaykumarl...@gmail.com wrote:

  Hi

  I've a problem handling a sub window which is created using ajax, the
  scenario i'm working in is i've a image which can be applied as theme
  to my webpage so when i'm clicking on the image the image opens in a
  new window with a Applytheme button at the bottom. Now i need to
  click on the Applytheme button in the new window which i'm not able
  to do. so please help me with this.

  i used the following code but it didnt work

  e.button(:value, Log In).click
  ie.link(:href, javascript:__doPostBack
  ('ctl00$lnkbtnPreferences','')).click
  ie.link(:href, http://192.168.25.10:215/ChangeSkin.aspx;).click
  ie.button(:name, ctl00$cph$ImageOrange).click
  sleep 5
  NOW THE IMAGE OPENS AS A SUB WINDOW
  #ie.image(:id, __VIEWSTATE).click
  #ie2 = Watir::IE.attach(:url, 'ChangeSkinPopupWindow.aspx')
  #ie3 = Watir::IE.attach(:title, 'Change Skin')

  ie.button(:name, btnAppltTheme).document.scrollintoview
  ie.button(:name,btnAppltTheme).click
  end
  end

  I TRIED USING DIALOG ALSO BUT IT DIDNT DO ANY GOOD.
  #dialog = ie.modal_dialog
  #dialog = ie.modal_dialog(:hwnd)
  #dialog = ie.modal_dialog(:title, 'Change Skin')

  so please suggest some solution...

  thankingyou
--~--~-~--~~~---~--~~
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: Working with Ajax and watir

2009-04-20 Thread Chuck van der Linden

Look I'm not sure how to make this any clearer

Without direct access to the page you are tryng to test, there's no
way anyone here can tell you exactly what you need to do (i.e.
suggest the changes required) to make things work (aka do your job
for you)

Without access to output and error information, or at the very least a
desciption of what happened (such as which puts statements executed)
there is NO WAY people are going to know what parts of the code you
provide worked or didn't work against a site they have no access to..
dispite above average intelligence, troubleshooting skills, coding
skills, and just being all around great charming folks, NOBODY here is
claravoient, omniscient, or a mind reader.. (much less in my case
having more than a 50% chance of spelling those right on the first
try)

The best we can do is try to point you in the right direction and tell
you things you can try, things to check for, and give suggestions as
to what might be the problem.

In order to be successful testing against Web UI's, and particular to
AUTOMATE testing against web UI's, you need the following:
 1) basic understanding of how HTTP, HTML, webpages, Javascript  etc
work..  what it means when someone refers to a 'div' or a 'frame' etc
on a page.  and how developers 'make things happen' in a web
environment.   I recommend webmaster in a nutshell as a decent
REFERENCE book that covers much of that territory, or will at lest
give most folks a chance to get started.
 2) Understanding of how to use either IE Developer toolbar, or
Firebug, to dissect elements of a website and identify what they are,
what they are contained within etc.
 3) Ability to read, understand, and execute simple instructions such
as:

You need to determine if that's really some kind of popup, (and if
so
what type) or if it's just a div that looks and behaves a bit like a
popup. 

and then respond with the requested information, or the results of the
enquirey you were told to undertake.




On Apr 20, 2:52 am, spike vinaykumarl...@gmail.com wrote:
 Hi

 i went through the link and did some changes but it didnt work for me
 below is the code i'm using to handle the ajax popup. please suggest
 the changes required

 require 'Watir/ie'
 require 'test/unit'
 require 'watir/testcase'
 require 'win32ole'
 require 'watir/contrib/enabled_popup'

 class Learntrack  Test::Unit::TestCase
   def test_learntrack1
 ie = Watir::IE.start http://192.168.25.10:215/;
 ie.maximize()
 ie.text_field(:name, Login1$UserName).set(vinay)
 ie.text_field(:name, Login1$Password).set(computer)
 ie.checkbox(:name, Login1$RememberMe).click
 ie.button(:value, Log In).click
 ie.link(:href, javascript:__doPostBack
 ('ctl00$lnkbtnPreferences','')).click
 ie.link(:href, http://192.168.25.10:215/ChangeSkin.aspx;).click
 ie.button(:name, ctl00$cph$ImageOrange).click
 sleep 8
 while (!ie.button(:id, btnAppltTheme).exists?)
   puts button exists
 ie.button(:id, btnAppltTheme).click
   sleep 2
   popupchecker(ie, Apply Theme)
 end
 end

 #popup
 def popupchecker(browser, text)
     Timeout::timeout(2) do
       begin
         puts popupchecker begins.
         puts browser.enabled_popup == #{browser.enabled_popup}
         if browser.enabled_popup
           puts popup enabled.
           hwnd = browser.enabled_popup(5)
           puts hwnd.to_s
           w = WinClicker.new
           w.makeWindowActive(hwnd)
           w.clickWindowsButton_hwnd(hwnd, text)
         end
         rescue Timeout::Error
           puts 'No popup existed.'
         end
       end
     end
 end

 On Apr 18, 4:24 am, Chuck van der Linden sqa...@gmail.com wrote:



  You may want to read this 
  thread...http://groups.google.com/group/watir-general/browse_thread/thread/075...

  You need to determine if that's really some kind of popup, (and if so
  what type) or if it's just a div that looks and behaves a bit like a
  popup.

  On Apr 17, 2:09 am, spike vinaykumarl...@gmail.com wrote:

   Hi

   I've a problem handling a sub window which is created using ajax, the
   scenario i'm working in is i've a image which can be applied as theme
   to my webpage so when i'm clicking on the image the image opens in a
   new window with a Applytheme button at the bottom. Now i need to
   click on the Applytheme button in the new window which i'm not able
   to do. so please help me with this.

   i used the following code but it didnt work

   e.button(:value, Log In).click
   ie.link(:href, javascript:__doPostBack
   ('ctl00$lnkbtnPreferences','')).click
   ie.link(:href, http://192.168.25.10:215/ChangeSkin.aspx;).click
   ie.button(:name, ctl00$cph$ImageOrange).click
   sleep 5
   NOW THE IMAGE OPENS AS A SUB WINDOW
   #ie.image(:id, __VIEWSTATE).click
   #ie2 = Watir::IE.attach(:url, 'ChangeSkinPopupWindow.aspx')
   #ie3 = Watir::IE.attach(:title, 'Change Skin')

   ie.button(:name, btnAppltTheme).document.scrollintoview
   ie.button(:name,btnAppltTheme).click
   end
   end

   I TRIED USING DIALOG ALSO BUT IT 

[wtr-general] Re: Working with Ajax and watir

2009-04-17 Thread Chuck van der Linden

You may want to read this thread...
http://groups.google.com/group/watir-general/browse_thread/thread/0751c85e0bf98cd5?hl=en#

You need to determine if that's really some kind of popup, (and if so
what type) or if it's just a div that looks and behaves a bit like a
popup.

On Apr 17, 2:09 am, spike vinaykumarl...@gmail.com wrote:
 Hi

 I've a problem handling a sub window which is created using ajax, the
 scenario i'm working in is i've a image which can be applied as theme
 to my webpage so when i'm clicking on the image the image opens in a
 new window with a Applytheme button at the bottom. Now i need to
 click on the Applytheme button in the new window which i'm not able
 to do. so please help me with this.

 i used the following code but it didnt work

 e.button(:value, Log In).click
 ie.link(:href, javascript:__doPostBack
 ('ctl00$lnkbtnPreferences','')).click
 ie.link(:href, http://192.168.25.10:215/ChangeSkin.aspx;).click
 ie.button(:name, ctl00$cph$ImageOrange).click
 sleep 5
 NOW THE IMAGE OPENS AS A SUB WINDOW
 #ie.image(:id, __VIEWSTATE).click
 #ie2 = Watir::IE.attach(:url, 'ChangeSkinPopupWindow.aspx')
 #ie3 = Watir::IE.attach(:title, 'Change Skin')

 ie.button(:name, btnAppltTheme).document.scrollintoview
 ie.button(:name,btnAppltTheme).click
 end
 end

 I TRIED USING DIALOG ALSO BUT IT DIDNT DO ANY GOOD.
 #dialog = ie.modal_dialog
 #dialog = ie.modal_dialog(:hwnd)
 #dialog = ie.modal_dialog(:title, 'Change Skin')

 so please suggest some solution...

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