New select list code is not working(WATIR 6.8)

25 views
Skip to first unread message

rajagopal...@gmail.com

unread,
Sep 4, 2017, 2:53:48 AM9/4/17
to Watir General
I have written the below code

browser.select_list(:id, "ProductGroup").select!("Fire Products")


It's not choosing any option as well as it's not throwing any error. 

I know this has been done through Java script and don't know why it's not working. 

rajagopal...@gmail.com

unread,
Sep 4, 2017, 3:18:25 AM9/4/17
to Watir General
To be close it 's choosing but not reflecting in the select list. But selenium select does the Job properly.  I believe after the choose, selenium is triggering something which Javascript fails to trigger that. 

Titus Fortner

unread,
Sep 4, 2017, 2:00:40 PM9/4/17
to watir-general
Out of curiosity, are you testing it on a site using React?

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

rajagopalan madasami

unread,
Sep 5, 2017, 1:34:32 AM9/5/17
to watir-...@googlegroups.com
No I am not. Actually it's choosing but it's not reflecting, clicking the option through selenium refreshes the page and once option is selected field gets disabled but nothing is happening while I choose through JavaScript.

You received this message because you are subscribed to a topic in the Google Groups "Watir General" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/watir-general/lUkyU5-C0Eg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to watir-general+unsubscribe@googlegroups.com.

Titus Fortner

unread,
Sep 5, 2017, 2:35:20 AM9/5/17
to Watir General
Ah, yes, JavaScript isn't going to fire the same events as when Watir goes through the driver end point. It doesn't sound like `#select!` will work for you.


On Monday, September 4, 2017 at 10:34:32 PM UTC-7, rajagopalan madasami wrote:
No I am not. Actually it's choosing but it's not reflecting, clicking the option through selenium refreshes the page and once option is selected field gets disabled but nothing is happening while I choose through JavaScript.
On 04-Sep-2017 11:30 PM, "Titus Fortner" <titusf...@gmail.com> wrote:
Out of curiosity, are you testing it on a site using React?
On Mon, Sep 4, 2017 at 12:18 AM, <rajagopal...@gmail.com> wrote:
To be close it 's choosing but not reflecting in the select list. But selenium select does the Job properly.  I believe after the choose, selenium is triggering something which Javascript fails to trigger that. 


On Monday, September 4, 2017 at 12:23:48 PM UTC+5:30, rajagopal...@gmail.com wrote:
I have written the below code

browser.select_list(:id, "ProductGroup").select!("Fire Products")


It's not choosing any option as well as it's not throwing any error. 

I know this has been done through Java script and don't know why it's not working. 

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


---
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-genera...@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


---
You received this message because you are subscribed to a topic in the Google Groups "Watir General" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/watir-general/lUkyU5-C0Eg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to watir-genera...@googlegroups.com.

rajagopal...@gmail.com

unread,
Sep 5, 2017, 2:58:21 AM9/5/17
to Watir General
Yes. But I wanted to tell something about the last release

set!

It's completely useful and it's brilliantly managed now by sending first character and last character through selenium. I have checked with 3 lack character and it drastically produces the result. It quickly enters all the characters meanwhile selenium takes more than 15 seconds(approximately)

select!

Here Java script is setting the value as selected

arguments[0].options[1].selected=true

and this is not equivalent to selenium because when we use selenium corresponding option is receiving the click which absolutely triggers all the actions which usually gets triggered when we choose manually. So this is not making any big difference and it's not giving good result as well. 

click!

Since you call element_call it waits for all four condition, but once after the click it is not waiting for page to load and it's expected when we click through JavaScript but we can include another statement which would help us to bring the result of  selenium click. There is a function in WATIR which will wait for page to load and this function has been written through Javascript, the function name is

 wait()

We need to call after executed the click, 

b.wait(30)

So I can write code like

b.click!
b
.wait(30)



So it would be meaningfull If your newly defined function click! would include wait(default_timeout) within itself.

something like

def click!
   document
.getElementId('something').click
   b
.wait(30)
end




What do you say?
Reply all
Reply to author
Forward
0 new messages