Discussion:
[wtr-general] Placing the value inside the text field loads the entire page, So Is there any function which will wait for the page load?
Raja gopalan
2017-02-11 15:21:56 UTC
Permalink
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Gerard Thomas
2017-02-11 15:44:05 UTC
Permalink
You could always wait for an element on the page to exist again. like this

browser.element(:id, 'foo').wait_until_present

or you could add a hard sleep in there
Post by Raja gopalan
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-13 18:01:07 UTC
Permalink
My requirement is not the element to be present, but page is getting
refreshed after each entry to the text field, but watir doesn't wait for
page to be refreshed. It quickly goes to another field but what actually
happening was page is getting refreshed at that point so the recent entry
will be deleted.
Post by Gerard Thomas
You could always wait for an element on the page to exist again. like this
browser.element(:id, 'foo').wait_until_present
or you could add a hard sleep in there
Post by Raja gopalan
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Joe Fleck
2017-02-13 03:39:13 UTC
Permalink
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" <***@gmail.com> 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.

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

---
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 watir-general+***@googlegroups.com.
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Titus Fortner
2017-02-13 17:37:59 UTC
Permalink
With dynamic website implementations, the phrase "the page has finished
loading" doesn't really mean anything any more.
The best practice is to wait for the thing you are interacting with next.
Watir 6 has made this much more automatic, but some additional logic may
still be required to accomplish what you need.
We'd need to know what you want to have happen after the page has loaded to
be able to give more guidance.
Post by Joe Fleck
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
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.
http://groups.google.com/group/watir-general
---
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
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-13 18:07:56 UTC
Permalink
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.
Post by Titus Fortner
With dynamic website implementations, the phrase "the page has finished
loading" doesn't really mean anything any more.
The best practice is to wait for the thing you are interacting with next.
Watir 6 has made this much more automatic, but some additional logic may
still be required to accomplish what you need.
We'd need to know what you want to have happen after the page has loaded
to be able to give more guidance.
Post by Joe Fleck
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
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.
http://groups.google.com/group/watir-general
---
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
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-13 18:01:54 UTC
Permalink
My problem is after setting the value. Page is getting refreshed after
setting the value.
Post by Joe Fleck
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
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Titus Fortner
2017-02-13 18:05:09 UTC
Permalink
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed after
setting the value.
Post by Joe Fleck
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
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-13 18:10:44 UTC
Permalink
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed after
setting the value.
Post by Joe Fleck
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
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Super Kevy
2017-02-14 15:50:21 UTC
Permalink
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.
Post by Raja gopalan
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed after
setting the value.
Post by Joe Fleck
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
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Titus Fortner
2017-02-14 18:19:25 UTC
Permalink
I updated my response on stack overflow if you didn't see it.
Post by Super Kevy
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.
Post by Raja gopalan
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed after
setting the value.
Post by Joe Fleck
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
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?
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-15 09:00:50 UTC
Permalink
I replied back, the code which you have given is not working. I have given
the written code of mine and also the error.


hi, I have written this code
b.text_field(:id,'policyStartDate').set '15/02/2017'
b.text_field(:id,'policyStartDate').wait_until(&:stale?)

But it's throwing this error
C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.0.3/lib/watir/ele‌​ments/element.rb:486‌​:instale?':
Can not check staleness of unused element (Watir::Exception::Error)`

Note : In my project, they have handle this page load using Java Script and
it works fine.
Post by Titus Fortner
I updated my response on stack overflow if you didn't see it.
Post by Super Kevy
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.
Post by Raja gopalan
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed after
setting the value.
Post by Joe Fleck
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
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?
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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,
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-17 11:36:11 UTC
Permalink
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,'***@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,'***@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("***@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)
Post by Titus Fortner
I updated my response on stack overflow if you didn't see it.
Post by Super Kevy
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.
Post by Raja gopalan
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed after
setting the value.
Post by Joe Fleck
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
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?
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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,
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Super Kevy
2017-02-17 17:50:33 UTC
Permalink
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
Post by Raja gopalan
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
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
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
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)
Post by Titus Fortner
I updated my response on stack overflow if you didn't see it.
Post by Super Kevy
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.
Post by Raja gopalan
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed
after setting the value.
Post by Joe Fleck
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
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?
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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,
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Titus Fortner
2017-02-17 18:00:54 UTC
Permalink
Also, to clarify. In Watir `#set` is combination of `#clear` and
`#send_keys` for text editable elements. Everything that works for
Selenium's `#send_keys` will work for Watir's `#set`, so just make sure
you are using the method you need.
Post by Super Kevy
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
https://watirmelon.blog/2011/07/19/sending-special-keys-to-watir-webdriver/
http://www.rubydoc.info/github/watir/watir-classic/Watir%2FElement%3Asend_keys
Post by Raja gopalan
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
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
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
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)
Post by Titus Fortner
I updated my response on stack overflow if you didn't see it.
Post by Super Kevy
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.
Post by Raja gopalan
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed
after setting the value.
Post by Joe Fleck
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
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?
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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,
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-18 14:50:40 UTC
Permalink
Hi Titus,

Yes I know it's a combination of both. I am saying my problem is not
resolved. When I execute this line

b.text_field(:id,'***@insuranceAmountVO@amount').set '12121'


*It continuously refreshing the page, It's not entering any value, but it **continuously** clearing the text field and refreshing the page, it's not going after that. *
Post by Titus Fortner
Also, to clarify. In Watir `#set` is combination of `#clear` and
`#send_keys` for text editable elements. Everything that works for
Selenium's `#send_keys` will work for Watir's `#set`, so just make sure
you are using the method you need.
Post by Super Kevy
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
https://watirmelon.blog/2011/07/19/sending-special-keys-to-watir-webdriver/
http://www.rubydoc.info/github/watir/watir-classic/Watir%2FElement%3Asend_keys
Post by Raja gopalan
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
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
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
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)
Post by Titus Fortner
I updated my response on stack overflow if you didn't see it.
Post by Super Kevy
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.
Post by Raja gopalan
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed
after setting the value.
Post by Joe Fleck
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
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?
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-18 14:56:10 UTC
Permalink
Hi, If you are having teamviewer, I can show my website to you! I can show
you the running !
Post by Titus Fortner
Also, to clarify. In Watir `#set` is combination of `#clear` and
`#send_keys` for text editable elements. Everything that works for
Selenium's `#send_keys` will work for Watir's `#set`, so just make sure
you are using the method you need.
Post by Super Kevy
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
https://watirmelon.blog/2011/07/19/sending-special-keys-to-watir-webdriver/
http://www.rubydoc.info/github/watir/watir-classic/Watir%2FElement%3Asend_keys
Post by Raja gopalan
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
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
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
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)
Post by Titus Fortner
I updated my response on stack overflow if you didn't see it.
Post by Super Kevy
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.
Post by Raja gopalan
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed
after setting the value.
Post by Joe Fleck
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
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?
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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,
For more options, visit https://groups.google.com/d/optout.
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-18 15:12:19 UTC
Permalink
I have used your code, but it's only deleting the content in the text
field, it's not entering the value, this is the code I have written
Post by Super Kevy
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
https://watirmelon.blog/2011/07/19/sending-special-keys-to-watir-webdriver/
http://www.rubydoc.info/github/watir/watir-classic/Watir%2FElement%3Asend_keys
Post by Raja gopalan
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
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
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
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)
Post by Titus Fortner
I updated my response on stack overflow if you didn't see it.
Post by Super Kevy
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.
Post by Raja gopalan
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed
after setting the value.
Post by Joe Fleck
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
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?
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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,
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-18 15:38:13 UTC
Permalink
Hi Super Kevy and Titus,

I have resolved the problem now. But set method is still not working. It
continues to delete the content of the text_field and refreshes.

And super kevy, your input sequence is wrong, So I have modified and given
it's working

b.text_field(:id, 'flattendListflattenedPolicyItems|***@innerVO@***@amount').send_keys [:control, "a"], :backspace, "12345",:tab
You can see sequence I sent the keys and also I have included the tab key at the end. It works fine.

Hi Titus, element.wait_until(&:stale?) is not necessary becasue watir automatically waits until page refreshes.

But I still wonder why set method is not working here! It simply refreshes delete the content and refreshes the page again and again.
Post by Super Kevy
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
https://watirmelon.blog/2011/07/19/sending-special-keys-to-watir-webdriver/
http://www.rubydoc.info/github/watir/watir-classic/Watir%2FElement%3Asend_keys
Post by Raja gopalan
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
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
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
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)
Post by Titus Fortner
I updated my response on stack overflow if you didn't see it.
Post by Super Kevy
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.
Post by Raja gopalan
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed
after setting the value.
Post by Joe Fleck
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
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?
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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,
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-18 14:46:57 UTC
Permalink
This is not an issue, It calculates the premium value according to the sum
insured you entered when the page is refreshed.
Post by Super Kevy
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.
Post by Raja gopalan
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.
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed after
setting the value.
Post by Joe Fleck
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
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?
--
--
search before you ask, be nice.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raja gopalan
2017-02-13 18:16:34 UTC
Permalink
Hi Titus, did you read my following reply?

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.
- show quoted text -
Post by Titus Fortner
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.
Post by Raja gopalan
My problem is after setting the value. Page is getting refreshed after
setting the value.
Post by Joe Fleck
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
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.
http://groups.google.com/group/watir-general
---
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
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.

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

---
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 watir-general+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...