Thanks experts it worked now...

On Fri, May 17, 2013 at 9:37 PM, Chuck van der Linden <
[email protected]> wrote:

>
>
> On Friday, May 17, 2013 10:45:54 AM UTC-7, Dan wrote:
>>
>> You may need a when_present because if that list is being populated via
>> some other selection or ajax it might not be there when you're trying to
>> select it.
>>
>> @browser.select_list(:name => "siteName").when_present.**select
>> "ccfashion"
>>
>
> +1 for that idea.  I've had to do that a bunch on sites that use ajax
> calls to create the lists.  However in this case the error was not that it
> could not find the list, but the option, so we may need to wait for the
> option to be present, not the list.  I think this might work for that
>
>   @browser.select_list(:name =>
> "siteName").option("ccfashion").when_present.select
>
>
> A lot of times an indication this is needed is if a line of code works
> fine from IRB (because by the time you type in the code, the list is likely
> populated) but not when run in your script.   If you don't like IRB you
> could try something like this, to see if the item appears in the list over
> time
>
>   10.times do
>     puts @browser.select_list(:name => "siteName").include?("ccfashion")
>     sleep 1
>   end
>
> If that does not work, is there more than one list?  maybe you are finding
> a list that does not include that option?
>
>  puts @browser.select_lists(:name => "siteName").count   # should be 1 if
> there is only one list with that name
>
> Since the list has an ID that should be unique of the name is not, so you
> could try
>
> @browser.select_list(:id => "site").select "ccfashion"
>
>
>>
>> On Friday, May 17, 2013 12:07:53 PM UTC-4, watir webdriver wrote:
>>>
>>>
>>>
>>> On Friday, May 17, 2013 4:58:11 PM UTC+1, watir webdriver wrote:
>>>>
>>>> Hi,
>>>>
>>>> In my application I've to select an option from the list.I tried as
>>>> below but its not selecting the option:
>>>>
>>>> @browser.select_list(:name => "siteName").select "ccfashion"
>>>>
>>> @browser.select_list_element(:**name => "siteName").option(:value,
>>> 'ccfashion')
>>>
>>>>
>>>> HTML code:
>>>> <select id="site" onchange="$('input[name=**switchToSite]').val(true);
>>>> $('#switchSiteShopAdminForm').**submit();" name="siteName">
>>>> <option value="burton">burton</option>
>>>> <option value="burtoneu">burtoneu</**option>
>>>> <option value="cathkidston">**cathkidston</option>
>>>> <option value="ccfashion">ccfashion</**option>
>>>> <option value="chemistdirect">**chemistdirect</option>
>>>> <option value="cloggs">cloggs</option>
>>>> <option value="coggles">coggles</**option>
>>>> <option value="colorway">colorway</**option>
>>>> <option value="coopersofstortford">**coopersofstortford</option>
>>>> <option value="cottontraders">**cottontraders</option>
>>>> <option value="crewclothing">**crewclothing</option>
>>>> <option value="cultura">cultura</**option>
>>>> </select>
>>>>
>>>> Error message :
>>>>  "ccfashion" not found in select list (Watir::Exception::**
>>>> NoValueFoundException)
>>>>
>>>> Thanks in-advance.
>>>>
>>>  --
> --
> 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 a topic in the
> Google Groups "Watir General" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/watir-general/EcMT07GzGrs/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> 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.

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


Reply via email to