[wtr-general] Can you use id and index?

2012-10-11 Thread Adrian Killens
Is it possible to use both and index and an id to get button?

e.g. if I had a 10 buttons all with the id AddToBasket could I use the id 
and the index to just click the first of the 10?

Cheers
Aidy

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Can you use id and index?

2012-10-11 Thread Željko Filipin
On Thu, Oct 11, 2012 at 10:48 AM, Adrian Killens ack...@googlemail.com
wrote:
 Is it possible to use both and index and an id to get button?

Sure. Something like this:

browser.button(:id = AddToBasket, :index = 0) # the first button with
id one

 e.g. if I had a 10 buttons all with the id AddToBasket could I use the
id and the index to just click the first of the 10?

Actually, this will click the first button

browser.button(:id = AddToBasket).click

This too:

browser.button(:id = AddToBasket, :index = 0).click

And this will click the second one:

browser.button(:id = AddToBasket, :index = 1).click

By the way, ids should be unique on the page, you should let the developers
know.

Željko

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: click_no_wait no worky on Ruby 1.9.3

2012-10-11 Thread Jarmo Pertman
Maybe it has something to do with iframe. Can you go to the frame-s source 
url directly so you won't be inside of any frames and then click that 
button with #click_no_wait without being in the context of any frames?

If that helps then try again with frame, but this time edit the outputted 
command like this.

Instead of:
Watir::IE.attach(:hwnd, xx).frame({:tag_name=['frame', 'iframe'], 
:id='viewIFRAME'})

Like this:
Watir::IE.attach(:hwnd, xx).frame({:tag_name= Array.new  'frame'  
'iframe', :id='viewIFRAME'})

Jarmo Pertman
-
IT does really matter - http://itreallymatters.net

On Thursday, October 11, 2012 1:10:42 AM UTC+3, Paul wrote:

 Tried it with no success, also I note that the backslashes are there in my 
 1.9.2 installation. That path is my RUBYLIB env var.

 Regards

 On Thursday, 11 October 2012 05:37:31 UTC+13, Jarmo Pertman wrote:

 Can you try if changing \\ in that #click_no_wait command to / 
 instead will make any difference. I can see this entry in that command:

 C:\\Users\\pauld\\workspace\\SopranoMedicalRecords\\AutomatedTests\\med_rec\\

 Let us know of your results.

 Jarmo Pertman
 -
 IT does really matter - http://itreallymatters.net


 On Tuesday, October 9, 2012 6:29:16 AM UTC+3, Paul wrote:

 Edited subject to click_no_wait no worky on Ruby 1.9.3

 On Monday, 8 October 2012 10:57:02 UTC+13, Paul wrote:

 Here is my ruby version and gem list (after re-installing Ruby 1.9.3 
 and gems):

 C:\Users\pauld\workspace\SopranoMedicalRecords\AutomatedTests\med_rec\testsruby
  
 -v
 ruby 1.9.3p194 (2012-04-20) [i386-mingw32]

 C:\Users\pauld\workspace\SopranoMedicalRecords\AutomatedTests\med_rec\testsgem
  
 list

 *** LOCAL GEMS ***

 addressable (2.3.2)
 bigdecimal (1.1.0)
 builder (3.1.3)
 childprocess (0.3.5)
 commonwatir (4.0.0)
 ffi (1.1.5 x86-mingw32)
 hoe (3.1.0)
 io-console (0.3)
 json (1.5.4)
 libwebsocket (0.1.5)
 mini_magick (3.2.1)
 minitest (2.5.1)
 multi_json (1.3.6)
 nokogiri (1.5.5 x86-mingw32)
 rake (0.9.2.2)
 rautomation (0.7.2)
 rdoc (3.9.4)
 ruby-oci8 (2.1.2 x86-mingw32)
 rubyzip (0.9.9)
 s4t-utils (1.0.4)
 selenium-webdriver (2.25.0)
 subexec (0.0.4)
 sys-proctable (0.9.1 universal-mingw32)
 user-choices (1.1.6.1)
 watir (4.0.0 x86-mingw32)
 watir-classic (3.2.0)
 watir-webdriver (0.6.1)
 win32-api (1.4.8 x86-mingw32)
 win32-process (0.7.0)
 win32screenshot (1.0.7)
 windows-api (0.4.2)
 windows-pr (1.2.2)
 xml-simple (1.1.1)
 yajl-ruby (1.1.0 x86-mingw32)

 Here is an IRB session, the button to click is deep within some frames. 

 irb(main):014:0 require 'rubygems'
 = true
 irb(main):015:0 require 'watir-classic'
 = true
 irb(main):016:0 b = Watir::Browser.attach :url, /concerto/
 = #Watir::IE:0x..f953476 url=
 http://chch-medsrec-vm04/concerto/Concerto.htm; title=Concerto - 
 Example Clinician
 irb(main):017:0 cc = b.frame(:id, 'ConcertoContext')
 = #Watir::Frame:0x7a30ef0e located=false 
 specifiers={:tag_name=[frame, iframe], :id=ConcertoContext}
 irb(main):018:0 ca = cc.frame(:id, 'ConcertoApplication')
 = #Watir::Frame:0x750f406 located=false 
 specifiers={:tag_name=[frame, iframe], :id=ConcertoApplication}
 irb(main):019:0 eds = ca.frame(:name, 'EDSMain')
 = #Watir::Frame:0x..f91b2c866 located=false 
 specifiers={:tag_name=[frame, iframe], :name=EDSMain}
 irb(main):020:0 r = eds.frame(:name, 'Right')
 = #Watir::Frame:0x..f8e09a25e located=false 
 specifiers={:tag_name=[frame, iframe], :name=Right}
 irb(main):021:0 l = eds.frame(:name, 'Left')
 = #Watir::Frame:0x3d17c2c6 located=false 
 specifiers={:tag_name=[frame, iframe], :name=Left}
 irb(main):022:0 lt = l.frame(:name, 'LeftTop')
 = #Watir::Frame:0x..f860f0e9e located=false 
 specifiers={:tag_name=[frame, iframe], :name=LeftTop}
 irb(main):023:0 lb = l.frame(:name, 'LeftBottom')
 = #Watir::Frame:0x19ca55c6 located=false 
 specifiers={:tag_name=[frame, iframe], :name=LeftBottom}
 irb(main):024:0 lb.button(:id, 'exitButton').exist?
 = true
 irb(main):025:0 lb.button(:id, 'exitButton').click_no_wait
 = 
 irb(main):026:0 lb.button(:id, 'exitButton').click
 *[Manually clicked Ok button on javascript dialog]*
 = 0.065006 
 irb(main):027:0


 When I run from my framework you can see a flash (looks like a cmd 
 window for a split second) as if the button is clicked (click_no_wait) but 
 the javascript dialog box does not appear as it did with watir versions 
 prior to 1.7.1.
 Running from IRB as above I do not see that flash.
 If I do a button.click the dialog box appears and blocks the script.
   
 Looking at the Ruby source there is not a click_no_wait method in 
 element.rb but the method is being called otherwise I would get a no 
 method 
 exception.

 Am I missing something here?

 thanks
 - paul


 On Friday, 5 October 2012 22:18:46 UTC+13, Jarmo Pertman wrote:

 I can't see Watir 4.0 in your gemlist. Can you show us minimal example 
 of your code, which fails (e.g. require statements, browser 
 initialization)?

 Jarmo Pertman
 -
 IT does really matter - 

[wtr-general] Re: Watir - Problem with pop up in IE9

2012-10-11 Thread Jarmo Pertman
It seems to be some different popup when you read the texts. I'm suspecting 
that in IE9 this is not a regular JavaScript confirm popup.

Jarmo Pertman
-
IT does really matter - http://itreallymatters.net

On Thursday, October 11, 2012 5:31:11 AM UTC+3, Paul wrote:


 https://lh4.googleusercontent.com/-MTUdBOfenBs/UHYvWQx8_CI/AAc/kI-LT-cE9PQ/s1600/IMG_11102012_151226.png
 For some reason my images of the popups did not save, attaching instead.

 On Thursday, 11 October 2012 15:26:08 UTC+13, Paul wrote:


 Hi, we have this popup in IE 8 and browser.alert.ok will work well.

 In IE9 the popup has changed to this:


 browser.alert.exists?
  true

 browser.alert.close
 - minimises the popup

 browser.alert.ok
 - nothing

 I have tried some suggestions from the web like overriding the 
 javascript, sending keystrokes ('l' as in alt + l) and various other things.

 Does anyone have a solution?

 I am using ruby 1.9.2 and watir-classic 3.2.0. I don't want to move to 
 webdriver as it does not have attach().

 Regards



-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Can you use id and index?

2012-10-11 Thread Joe Fleck
Hi,

If the button has text you can use that instead.

Joe
On Oct 11, 2012 4:48 AM, Adrian Killens ack...@googlemail.com wrote:

 Is it possible to use both and index and an id to get button?

 e.g. if I had a 10 buttons all with the id AddToBasket could I use the
 id and the index to just click the first of the 10?

 Cheers
 Aidy

 --
 Before posting, please read http://watir.com/support. In short: search
 before you ask, be nice.

 watir-general@googlegroups.com
 http://groups.google.com/group/watir-general
 watir-general+unsubscr...@googlegroups.com


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Can you use id and index?

2012-10-11 Thread Adrian Killens
Thank you once again! All sorted, I'm now using

browser.button(:id = AddToBasket, :index = 0) 

Aidy :-)

On Thursday, 11 October 2012 10:10:18 UTC+1, Željko Filipin wrote:

 On Thu, Oct 11, 2012 at 10:48 AM, Adrian Killens 
 ack...@googlemail.comjavascript: 
 wrote:
  Is it possible to use both and index and an id to get button?

 Sure. Something like this:

 browser.button(:id = AddToBasket, :index = 0) # the first button with 
 id one

  e.g. if I had a 10 buttons all with the id AddToBasket could I use the 
 id and the index to just click the first of the 10?

 Actually, this will click the first button 

 browser.button(:id = AddToBasket).click

 This too:

 browser.button(:id = AddToBasket, :index = 0).click

 And this will click the second one:

 browser.button(:id = AddToBasket, :index = 1).click

 By the way, ids should be unique on the page, you should let the 
 developers know.

 Željko


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Watir - Problem with pop up in IE9

2012-10-11 Thread Champ
I use rautomation and it works fine for the popup with the same title. I am 
on Ruby 1.9.2 and watir-classic 3.2.2 and IE9 too.

webpage_popup_title=Message from webpage
popup= RAutomation::Window.new(:title = webpage_popup_title, :adapter = 
:autoit)
popup.WinWait(webpage_popup_title,'',20)
if (popup.exists? ==true)
   popup.send_keys('{ENTER}')
end

On Thursday, October 11, 2012 6:58:44 AM UTC-4, Jarmo Pertman wrote:

 It seems to be some different popup when you read the texts. I'm 
 suspecting that in IE9 this is not a regular JavaScript confirm popup.

 Jarmo Pertman
 -
 IT does really matter - http://itreallymatters.net

 On Thursday, October 11, 2012 5:31:11 AM UTC+3, Paul wrote:


 https://lh4.googleusercontent.com/-MTUdBOfenBs/UHYvWQx8_CI/AAc/kI-LT-cE9PQ/s1600/IMG_11102012_151226.png
 For some reason my images of the popups did not save, attaching instead.

 On Thursday, 11 October 2012 15:26:08 UTC+13, Paul wrote:


 Hi, we have this popup in IE 8 and browser.alert.ok will work well.

 In IE9 the popup has changed to this:


 browser.alert.exists?
  true

 browser.alert.close
 - minimises the popup

 browser.alert.ok
 - nothing

 I have tried some suggestions from the web like overriding the 
 javascript, sending keystrokes ('l' as in alt + l) and various other things.

 Does anyone have a solution?

 I am using ruby 1.9.2 and watir-classic 3.2.0. I don't want to move to 
 webdriver as it does not have attach().

 Regards



-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com