Re: [wtr-general] Re: HELP - Acessing password (text) field

2014-11-25 Thread Justin Ko
It looks like there is sometimes a delay in the loading of the iframe 
containing the password field. Adding a wait to the setting of the password 
field solved the problem (at least for me):

browser.iframe(id: ws).text_field(id: claveConsultiva).when_present.set 
'bar'

The `when_present` method tells Watir to wait for the element to appear 
before setting it.

- Justin Ko


On Monday, November 24, 2014 5:49:02 PM UTC-5, Alberto Magalhães wrote:

 same error :-(

 require 'watir-webdriver'
 browser = Watir::Browser.new :chrome
 browser.goto(https://www.santandertotta.pt/pt_PT/Particulares.html;)
 #substituir o USERID pelo user de acesso
 browser.text_field(:name = usr).set foo
 browser.button(:value = Login).click
 #browser.goto '
 https://www.particulares.santandertotta.pt/pagina/indice/0,,276_1_2,00.html?usr=Nome%20de%20Utilizador
 '
 browser.iframe(id: ws).text_field(id: claveConsultiva).set 'bar'
 browser.iframe(id: ws).link(id: login_button).click

 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/iframe.rb:10:in
  
 `locate': unable to locate iframe using {:id=ws, :tag_name=iframe} 
 (Watir::Exception::UnknownFrameException)
 from 
 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/element.rb:510:in
  
 `assert_exists'
 from 
 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/iframe.rb:31:in
  
 `assert_exists'
 from 
 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/element.rb:532:in
  
 `locate'
 from 
 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/element.rb:510:in
  
 `assert_exists'
 from 
 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/user_editable.rb:11:in
  
 `set'
 from teste_2.rb:8:in `main'



 On Mon, Nov 24, 2014 at 10:44 PM, Titus Fortner titusf...@gmail.com 
 javascript: wrote:

 I take that back, I had a typo when trying to set. I'm not having any 
 problem with the code...

 2.1.2 :073  browser = Watir::Browser.new :chrome
  = #Watir::Browser:0x1f1ef64532cb8556 url=data:, title=data:, 
 2.1.2 :074  browser.goto(
 https://www.santandertotta.pt/pt_PT/Particulares.html;)
  = https://www.santandertotta.pt/pt_PT/Particulares.html; 
 2.1.2 :075  browser.text_field(:name = usr).set foo
  = nil 
 2.1.2 :076  browser.button(value: 'Login').click
  = [] 
 2.1.2 :077  browser.iframe(id: 'ws').text_field(id: 
 'claveConsultiva').set 'bar'
  = nil 
 2.1.2 :078  browser.iframe(id: 'ws').link(id: 'login_button').click
  = [] 
 2.1.2 :079  


 On Mon, Nov 24, 2014 at 4:36 PM, Alberto Magalhaes aacmag...@gmail.com 
 javascript: wrote:

 Joe,
 Line 10. thanks

 On Mon, Nov 24, 2014 at 10:35 PM, Alberto Magalhaes aacmag...@gmail.com 
 javascript: wrote:

 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/iframe.rb:10:in
  
 `locate': unable to locate iframe using {:id=ws, :tag_name=iframe} 
 (Watir::Exception::UnknownFrameException)
 from 
 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/element.rb:510:in
  
 `assert_exists'
 from 
 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/iframe.rb:31:in
  
 `assert_exists'
 from 
 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/element.rb:532:in
  
 `locate'
 from 
 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/element.rb:510:in
  
 `assert_exists'
 from 
 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/lib/watir-webdriver/user_editable.rb:11:in
  
 `set'
 from teste_2.rb:8:in `main'
 Exit code: 1

 On Mon, Nov 24, 2014 at 10:30 PM, Joe Fleck joefl...@gmail.com 
 javascript: wrote:

 Alberto,

 What line is this failing on?

 Joe

 On Mon, Nov 24, 2014 at 5:26 PM, Alberto Magalhaes 
 aacmag...@gmail.com javascript: wrote:

 Titus,

 I'm trying this:
 require 'watir-webdriver'
 browser = Watir::Browser.new :chrome
 browser.goto(https://www.santandertotta.pt/pt_PT/Particulares.html;)
 browser.text_field(:name = usr).set foo
 browser.button(:value = Login).click
 usr=Nome%20de%20Utilizador'
 browser.iframe(id: 'ws').text_field(id: 'claveConsultiva').set 'bar'
 browser.iframe(id: 'ws').link(id: 'login_button').click


 On Mon, Nov 24, 2014 at 9:36 PM, Titus Fortner titusf...@gmail.com 
 javascript: wrote:

 This works for me.

 browser = Watir::Browser.new :chrome
 browser.goto '
 https://www.particulares.santandertotta.pt/pagina/indice/0,,276_1_2,00.html?usr=Nome%20de%20Utilizador
 '
 browser.iframe(id: 'ws').text_field(id: 'identificacionUsuario').set 
 'Foo'
 browser.iframe(id: 'ws').text_field(id: 'claveConsultiva').set 'Bar'
 browser.iframe(id: 'ws').link(id: 'login_button').click

 On Mon, Nov 24, 2014 at 3:19 PM, Alberto Magalhães 
 aacmag...@gmail.com javascript: wrote:


 Joe and Titus 

 it's not working.

 I'm trying to access 

Re: [wtr-general] Re: HELP - Acessing password (text) field

2014-11-25 Thread Alberto Magalhaes
thanks it's working!!

On Tue, Nov 25, 2014 at 2:46 PM, Justin Ko justin.t...@gmail.com wrote:

 It looks like there is sometimes a delay in the loading of the iframe
 containing the password field. Adding a wait to the setting of the password
 field solved the problem (at least for me):

 browser.iframe(id: ws).text_field(id:
 claveConsultiva).when_present.set 'bar'

 The `when_present` method tells Watir to wait for the element to appear
 before setting it.

 - Justin Ko


 On Monday, November 24, 2014 5:49:02 PM UTC-5, Alberto Magalhães wrote:

 same error :-(

 require 'watir-webdriver'
 browser = Watir::Browser.new :chrome
 browser.goto(https://www.santandertotta.pt/pt_PT/Particulares.html;)
 #substituir o USERID pelo user de acesso
 browser.text_field(:name = usr).set foo
 browser.button(:value = Login).click
 #browser.goto 'https://www.particulares.santandertotta.pt/pagina/
 indice/0,,276_1_2,00.html?usr=Nome%20de%20Utilizador'
 browser.iframe(id: ws).text_field(id: claveConsultiva).set 'bar'
 browser.iframe(id: ws).link(id: login_button).click

 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/elements/iframe.rb:10:in `locate': unable to locate
 iframe using {:id=ws, :tag_name=iframe} (Watir::Exception::
 UnknownFrameException)
 from C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/elements/element.rb:510:in `assert_exists'
 from C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/elements/iframe.rb:31:in `assert_exists'
 from C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/elements/element.rb:532:in `locate'
 from C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/elements/element.rb:510:in `assert_exists'
 from C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/user_editable.rb:11:in `set'
 from teste_2.rb:8:in `main'



 On Mon, Nov 24, 2014 at 10:44 PM, Titus Fortner titusf...@gmail.com
 wrote:

 I take that back, I had a typo when trying to set. I'm not having any
 problem with the code...

 2.1.2 :073  browser = Watir::Browser.new :chrome
  = #Watir::Browser:0x1f1ef64532cb8556 url=data:, title=data:,
 2.1.2 :074  browser.goto(https://www.santandertotta.pt/pt_PT/
 Particulares.html)
  = https://www.santandertotta.pt/pt_PT/Particulares.html;
 2.1.2 :075  browser.text_field(:name = usr).set foo
  = nil
 2.1.2 :076  browser.button(value: 'Login').click
  = []
 2.1.2 :077  browser.iframe(id: 'ws').text_field(id:
 'claveConsultiva').set 'bar'
  = nil
 2.1.2 :078  browser.iframe(id: 'ws').link(id: 'login_button').click
  = []
 2.1.2 :079 


 On Mon, Nov 24, 2014 at 4:36 PM, Alberto Magalhaes aacmag...@gmail.com
 wrote:

 Joe,
 Line 10. thanks

 On Mon, Nov 24, 2014 at 10:35 PM, Alberto Magalhaes 
 aacmag...@gmail.com wrote:

 C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/elements/iframe.rb:10:in `locate': unable to
 locate iframe using {:id=ws, :tag_name=iframe} (Watir::Exception::
 UnknownFrameException)
 from C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/elements/element.rb:510:in `assert_exists'
 from C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/elements/iframe.rb:31:in `assert_exists'
 from C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/elements/element.rb:532:in `locate'
 from C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/elements/element.rb:510:in `assert_exists'
 from C:/Ruby21/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.6.11/
 lib/watir-webdriver/user_editable.rb:11:in `set'
 from teste_2.rb:8:in `main'
 Exit code: 1

 On Mon, Nov 24, 2014 at 10:30 PM, Joe Fleck joefl...@gmail.com
 wrote:

 Alberto,

 What line is this failing on?

 Joe

 On Mon, Nov 24, 2014 at 5:26 PM, Alberto Magalhaes 
 aacmag...@gmail.com wrote:

 Titus,

 I'm trying this:
 require 'watir-webdriver'
 browser = Watir::Browser.new :chrome
 browser.goto(https://www.santandertotta.pt/pt_PT/Particulares.html
 )
 browser.text_field(:name = usr).set foo
 browser.button(:value = Login).click
 usr=Nome%20de%20Utilizador'
 browser.iframe(id: 'ws').text_field(id: 'claveConsultiva').set 'bar'
 browser.iframe(id: 'ws').link(id: 'login_button').click


 On Mon, Nov 24, 2014 at 9:36 PM, Titus Fortner titusf...@gmail.com
 wrote:

 This works for me.

 browser = Watir::Browser.new :chrome
 browser.goto 'https://www.particulares.santandertotta.pt/pagina/
 indice/0,,276_1_2,00.html?usr=Nome%20de%20Utilizador'
 browser.iframe(id: 'ws').text_field(id:
 'identificacionUsuario').set 'Foo'
 browser.iframe(id: 'ws').text_field(id: 'claveConsultiva').set 'Bar'
 browser.iframe(id: 'ws').link(id: 'login_button').click

 On Mon, Nov 24, 2014 at 3:19 PM, Alberto Magalhães 
 aacmag...@gmail.com wrote:


 Joe and Titus

 it's not working.

 I'm trying to access 'claveConsultiva' that is present on