Hi Pallavi,

May be the focus missing here. So please adjust the changes here and try it.
(its not a exact solution but it may be help some times)


     # Windows API constants
  INPUT_MOUSE = 0
  MOUSEEVENTF_LEFTDOWN = 0x0002
  MOUSEEVENTF_LEFTUP = 0x0004
  MOUSEEVENTF_RIGHTDOWN = 0x0008
  MOUSEEVENTF_RIGHTUP = 0x0010


This code is available under Watir module (which was you pasted in first
thread.)


Thanks.

On Tue, Sep 29, 2009 at 4:55 PM, Pallavi Sharma <[email protected]>wrote:

> Hey Ravee
>
> Its not working :(
>
> I have a scenario in which :
>
> 1. A link opens a Div tag on which a image open another div tag which
> contains a table.
> 2. Now, i have to click on a table cell to select my date
> 3. For the same i am using this function.
> 4. It open the calendar div but doesn't click on the table cell present
> inside the calendar div.
>
> The coordinates it returns for the cell are x=0,y=112 [doesn't work]
>
> The icon which opens the calendar, its coordinates are: x=503,y=499  [this
> one works]
>
> Is my page_container wrong or whats the issue?
>
>
> The screen shot is attached and i am trying to save the page but not able
> to. The code snippets are attached.
>
> Please help!!
>
> Thanks
>
> Pallavi
>
>
> On Tue, Sep 29, 2009 at 4:43 PM, Raveendran P <[email protected]>wrote:
>
>> Hi pallavi,
>>
>> Yes. Def it will work..
>>
>> If not then pls paste ur html code here.
>>
>> Thanks
>> P.Raveendran
>>
>>
>> On Tue, Sep 29, 2009 at 4:10 PM, Pallavi Sharma 
>> <[email protected]>wrote:
>>
>>> Hey Ravee
>>>
>>> Thanks a ton, maybe some one can update the stuff there at tha link, it
>>> will surely help.
>>>
>>> by the way: win32ole_pp throws an error so i removed it.
>>>
>>> One more thing i will be using this on a div containg table, and its
>>> table cell will it work??
>>>
>>> Thanks
>>>
>>> Pallavi
>>>
>>>
>>> On Tue, Sep 29, 2009 at 3:58 PM, Raveendran P <
>>> [email protected]> wrote:
>>>
>>>> Hi pallavi,
>>>>
>>>> Pls add and try again
>>>>
>>>> May be try this all possibilities
>>>>
>>>> require 'rubygems'
>>>> require 'watir'
>>>> require 'pp'
>>>> require 'win32ole'
>>>> require "win32ole_pp"
>>>> require 'watir/WindowHelper'
>>>>
>>>>
>>>> Awaiting your reply...
>>>>
>>>> Thanks
>>>>
>>>>
>>>> On Tue, Sep 29, 2009 at 3:17 PM, Pallavi Sharma <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi All
>>>>>
>>>>> I am trying to work on the script:
>>>>>
>>>>> require 'watir'
>>>>>
>>>>> module Watir
>>>>>   class Element
>>>>>     def top_edge
>>>>>       assert_exists
>>>>>       assert_enabled
>>>>>       ole_object.getBoundingClientRect.top.to_i
>>>>>     end
>>>>>
>>>>>     def top_edge_absolute
>>>>>       top_edge + container.document.parentWindow.screenTop.to_i
>>>>>     end
>>>>>
>>>>>     def left_edge
>>>>>       assert_exists
>>>>>       assert_enabled
>>>>>       ole_object.getBoundingClientRect.left.to_i
>>>>>     end
>>>>>
>>>>>     def left_edge_absolute
>>>>>       left_edge + container.document.parentWindow.screenLeft.to_i
>>>>>     end
>>>>>
>>>>>     def right_click
>>>>>       x = left_edge_absolute
>>>>>       y = top_edge_absolute
>>>>>       #puts "x: #{x}, y: #{y}"
>>>>>       WindowsInput.move_mouse(x, y)
>>>>>       WindowsInput.right_click
>>>>>     end
>>>>>   end
>>>>> end
>>>>>
>>>>> module WindowsInput
>>>>>   # Windows API functions
>>>>>  SetCursorPos = Win32API.new('user32','SetCursorPos', 'II', 'I')
>>>>>   SendInput = Win32API.new('user32','SendInput', 'IPI', 'I')
>>>>>
>>>>>   # Windows API constants
>>>>>   INPUT_MOUSE = 0
>>>>>   MOUSEEVENTF_LEFTDOWN = 0x0002
>>>>>   MOUSEEVENTF_LEFTUP = 0x0004
>>>>>   MOUSEEVENTF_RIGHTDOWN = 0x0008
>>>>>   MOUSEEVENTF_RIGHTUP = 0x0010
>>>>>
>>>>>   module_function
>>>>>
>>>>>   def send_input(inputs)
>>>>>     n = inputs.size
>>>>>     ptr = inputs.collect {|i| i.to_s}.join # flatten arrays into single
>>>>> string
>>>>>     SendInput.call(n, ptr, inputs[0].size)
>>>>>   end
>>>>>
>>>>>   def create_mouse_input(mouse_flag)
>>>>>     mi = Array.new(7, 0)
>>>>>     mi[0] = INPUT_MOUSE
>>>>>     mi[4] = mouse_flag
>>>>>     mi.pack('LLLLLLL') # Pack array into a binary sequence usable to
>>>>> SendInput
>>>>>   end
>>>>>
>>>>>   def move_mouse(x, y)
>>>>>     SetCursorPos.call(x, y)
>>>>>   end
>>>>>
>>>>>   def right_click
>>>>>     rightdown = create_mouse_input(MOUSEEVENTF_RIGHTDOWN)
>>>>>     rightup = create_mouse_input(MOUSEEVENTF_RIGHTUP)
>>>>>     send_input( [rightdown, rightup] )
>>>>>   end
>>>>> end
>>>>>
>>>>> # Open google index page, and send a right click to the logo image
>>>>> ie = Watir::IE.new
>>>>> ie.goto('www.google.com')
>>>>> image = ie.image(:index, 1)
>>>>> image.right_click
>>>>> # Then, bring up the properties menu (works with IE6, at least)
>>>>> ie.send_keys("{UP}{ENTER}")
>>>>>
>>>>>
>>>>> But it keeps giving me the error:
>>>>>
>>>>> >ruby TrryMe.rb
>>>>> TrryMe.rb:37: uninitialized constant WindowsInput::Win32API (NameError)
>>>>> >Exit code: 1
>>>>>
>>>>>
>>>>>
>>>>> What is that i am doing wrong??
>>>>>
>>>>> I am using watir 1.6.2
>>>>>
>>>>>
>>>>> Please help.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Pallavi.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> P.Raveendran
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>> --
>> Regards,
>> P.Raveendran
>> http://raveendran.wordpress.com
>>
>>
>>
>>
>>
>
> >
>


-- 
Regards,
P.Raveendran
http://raveendran.wordpress.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to