Why not just @browser.send_keys [ id , :enter ]

http://stackoverflow.com/questions/4699687/when-to-use-self-foo-instead-of-foo-in-ruby-methods

1) It is idiomatic to prefer to omit self. when invoking methods; it is 
generally never needed.

2) You must use self.foo = xxx when calling a setter method, instead of foo 
= xxx, so that Ruby realizes that you are not trying create a new local 
variable.

3) You cannot use self.foo(...) to call a private method; you must instead 
call just foo(...).




On Friday, September 26, 2014 9:53:47 AM UTC-5, Sudarshan Study wrote:
>
> Thanks for responding Roman and Super Kevy!
>
> My code is as below
>
> def search_emp(id)
>
> #self.emp_id = id
>
> @browser.send_keys [self.emp_id=id , :enter]
> end
>
> the solution here works ,but send the emp id twice and hit enters
> for e.g.
> if emp id = 1234
> it sends 12341234 and then enters.
>
> Regards,
> Sudarshan.
>
>
>
>
> On Wednesday, September 24, 2014 11:52:11 AM UTC-4, roman.g.rodriguez 
> wrote:
>>
>> Hi,
>>
>> Supose that you are focused on a field you want to type employee id and 
>> press Enter called input, you could try something like this:
>>
>> input = @browser.find_element(:id, "employee-id")
>>
>> *input.send_keys ["12345678", :enter]*
>> # "12345678" is the employee id
>>
>> Regards
>>
>>
>> El lunes, 22 de septiembre de 2014 09:51:06 UTC-3, Sudarshan Study 
>> escribió:
>>>
>>>  @browser.send_keys :enter
>>>
>>>  : works with firefox , but is not working with chrome browser. Kindly 
>>> let me know if there is any other way to perform same task. Thanks!
>>>
>>>

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

[email protected]
http://groups.google.com/group/watir-general
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to