Watirwebdriver - Click on drop down value is not visible until I scroll down the list

219 views
Skip to first unread message

watir webdriver

unread,
Jan 23, 2014, 10:04:58 AM1/23/14
to watir-...@googlegroups.com
Hi,

I'm using watir-webdriver to automate our functional testing with an application. In the process we need to click on a drop down and select a value from the drop down. The problem i'm facing is that i'm able to click on the elements that are visible in the drop-down however, when i tried clicking on an item which is just below the visible item, its just passing the scenario without selecting the item.

HTML code:

<select class="exp_left_hand">
<option value="">Please select</option>
<optgroup label="Users">
<option data-s="false" value="countrycode">countrycode</option>
<option data-s="true" value="u.visitor">Visitor</option>
<option data-s="false" value="keyword">keyword</option>
</optgroup>
<optgroup class="identifier" label="Keywords">
<option data-s="false" value="smart">smart</option>
<option data-s="false" value="purchasehistorybyattributes">purchasehistorybyattributes</option>
<option data-s="false" value="purchasehistorybycategory">purchasehistorybycategory</option>
<option data-s="false" value="tags">tags</option>
</optgroup>
</select>

The optgroup label as "Keywords" is invisible in the dropdown.

I've tried below ways but not luck :

 @browser.select_list(:class => "exp_left_hand").optgroup(:class => "identifier").option(:value => "tags").fire_event 'onclick'  # Without selecting the option its passing the scenario
@browser.select_list(:class => "exp_left_hand").optgroup(:class => "identifier").option(:value => "tags").when_present.click # is getting timedout

Thanks in advance



John Fitisoff

unread,
Jan 23, 2014, 10:28:11 AM1/23/14
to watir-...@googlegroups.com
The hover event? Also you could try using send_keys, which I think lets you simulate a down arrow keypress (:arrow_down). But maybe someone else has a better idea



--
--
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-genera...@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-genera...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


watir webdriver

unread,
Jan 23, 2014, 11:43:31 AM1/23/14
to watir-...@googlegroups.com
@browser.select_list(:class => "exp_left_hand").optgroup(:class => "identifier").select "tags"


Error :
expected Hash or (:how, 'what'), got ["tags"] (ArgumentError)

Dan

unread,
Jan 23, 2014, 12:32:24 PM1/23/14
to watir-...@googlegroups.com
You want something like this.

b.option(:text => "tags").select

Oscar Rieken

unread,
Jan 23, 2014, 2:50:51 PM1/23/14
to watir-...@googlegroups.com
On Thu, Jan 23, 2014 at 12:32 PM, Dan <dfr...@gmail.com> wrote:
You want something like this.

b.option(:text => "tags").select

this
 

watir webdriver

unread,
Jan 24, 2014, 9:22:17 AM1/24/14
to watir-...@googlegroups.com
Thanks for your email but its not working..throwing below error:

Tried like this :
b.option(:text, "tags").select


 expected Hash or (:how, 'what'), got ["default"] (ArgumentError)

Any suggestions?

Thanks in-advance




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/FXdGZXrSyUE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to watir-genera...@googlegroups.com.

watir webdriver

unread,
Jan 24, 2014, 9:26:49 AM1/24/14
to watir-...@googlegroups.com
Thanks for your email but its not working..throwing below error:

Tried like this :
b.option(:text, "tags").select


 expected Hash or (:how, 'what'), got ["tags"] (ArgumentError)

Any suggestions?

Thanks in-advance


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/groups/opt_out.

--
--
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/FXdGZXrSyUE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to watir-general+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages