Sounds resolved
So it looks like you need to send a tab as the control probably has an 
onblur JS event tied to it.
So with send_keys you can include special keys like :Home :Shift :End to 
select and :tab to move to the next focus
I believe you can even add delays in the send_keys stream.  

browser.text_field.send_keys "hello", [:control, "a"], :backspace

See: https://watirmelon.blog/2011/07/19/sending-special-keys-to-watir-webdriver/
http://www.rubydoc.info/github/watir/watir-classic/Watir%2FElement%3Asend_keys



On Friday, February 17, 2017 at 5:36:11 AM UTC-6, Raja gopalan wrote:
>
> Hi Titus,
>
> Sorry for late reply! Your code which has been given in Stackoverflow is a 
> good catch but you are missing the crucial point that watir 
> text_field.set() method doesn't includes the tab So refresh doesn't start 
> until it moves on to the next field. 
>
> But what happens actually is, I am writing the following code
>
> b.text_field(:id,'insuranceAmountVO@amount').set '12121'
>
>
> But this code  doesn't enter the date there instead, it continue to locate 
> that element and keep refreshing the page continuously without an end. I 
> have never seen this behavior so far. 
>
> If I use this code(given below) send_keys instead of set
>
> b.text_field(:id,'insuranceAmountVO@amount').send_keys '12121'
>
>
> It appends this value with already existing value in the text field. So 
> it's not entering the intended data as well. 
>
> But all I want to say is, we are now using selenium using Java, it 
> perfectly enters the data but NOT using the below code
>
> driver.findElement(By.id("insuranceAmountVO@amount").send_keys "12121"
>
>
> but using this customized code it enters perfectly
>
> selenium.typeAndTab "12121"
>
>
> I went inside this function, but it's very huge and I couldn't figure out 
> what they are doing. 
>
> And I have the select_list problem too but I will create a separate 
> question for that. Our selenium framework selects successfully but Watir 
> doesn't! (I will create separate thread for that)
>
>
>  
>
> On Tuesday, February 14, 2017 at 11:49:32 PM UTC+5:30, Titus Fortner wrote:
>>
>> I updated my response on stack overflow if you didn't see it.
>>
>> On Tue, Feb 14, 2017 at 9:50 AM, Super Kevy <[email protected]> wrote:
>>
>>> So the issue occurs manually as well.  That suggests maybe there is a 
>>> bug. Perhaps bad JS validation or field validation. 
>>> You can always put a static sleep as a work-around. Not elegant.   
>>> Change the sets to send keys and see if the behaviour alters.
>>>
>>>
>>> On Monday, February 13, 2017 at 12:10:45 PM UTC-6, Raja gopalan wrote:
>>>>
>>>> Hi, I have replied to your post, I will page here as well
>>>>
>>>> Yes, that's what happen when we enter manually as well! 
>>>>
>>>> I have posted in stack over flow as well. But here I want to details 
>>>> things, I am working in a insurance application, where cover screen 
>>>> consist 
>>>> of many textfield to enter insured amount, but after each entry to the 
>>>> text 
>>>> field, page is getting refreshed,but watir doesn't wait for page to be 
>>>> refreshed, it quickly goes into next text_field, but next field is not 
>>>> ready but watir enters the data, since page is getting refreshed in the 
>>>> mean time recent entry is getting deleted. This refresh is not happening 
>>>> not only text_field but for radio button as well(which cover to choose). 
>>>>
>>>> I thought there is no solution to the problem but recently I have moved 
>>>> to selenium project where they have clearly managed this problem through 
>>>> JavaScript, they have a function called waitForPageToLoad, so after each 
>>>> entry they have called this function, So it waits until the page loads, It 
>>>> perfectly enters the data. So I thought I was missing the same kind of 
>>>> arrangement in WATIR, So If you can create the function called 
>>>> waitForPageToLoad, this would resolve this problem. 
>>>>
>>>>
>>>> On Monday, February 13, 2017 at 11:35:09 PM UTC+5:30, Titus Fortner 
>>>> wrote:
>>>>>
>>>>> Is that what happens when you do it manually? Watir is designed to 
>>>>> behave the same way as a user. You'll need to better explain what a user 
>>>>> would do and how Watir is not doing it that way.
>>>>>
>>>>>
>>>>>
>>>>> On Monday, February 13, 2017 at 12:01:55 PM UTC-6, Raja gopalan wrote:
>>>>>>
>>>>>> My problem is after setting the value. Page is getting refreshed 
>>>>>> after setting the value. 
>>>>>>
>>>>>> On Monday, February 13, 2017 at 9:09:18 AM UTC+5:30, Joe Fl wrote:
>>>>>>>
>>>>>>> Hi.
>>>>>>>
>>>>>>> I am not sure I follow what happens after the field is set but if 
>>>>>>> you need to wait for the text field you can use wait_until_present or 
>>>>>>> .present?.
>>>>>>>
>>>>>>> Joe
>>>>>>>
>>>>>>> On Feb 11, 2017 10:21 AM, "Raja gopalan" <[email protected]> 
>>>>>>> wrote:
>>>>>>>
>>>>>>> There are certain kind of a text_field which I am automating, when I 
>>>>>>> place the value there like
>>>>>>>
>>>>>>> b.text_field(:id,'something').set 'hi'
>>>>>>>
>>>>>>>
>>>>>>> It refresh the entire page or it reloads the page, but the above 
>>>>>>> code only wait until element present and place the value inside the 
>>>>>>> text 
>>>>>>> field but it doesn't take care of what happens after that. 
>>>>>>>
>>>>>>> Is there any function I can write like given below,
>>>>>>>
>>>>>>>  
>>>>>>> b.text_field(:id,'something').set 'hi'
>>>>>>>
>>>>>>> b.waitForPageToLoad # Code like this?
>>>>>>>
>>>>>>> -- 
>>>>>>> -- 
>>>>>>> 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.
>>>>>>>
>>>>>>>
>>>>>>> -- 
>>> -- 
>>> 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.
>>>
>>
>>

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