@@ -0,0 +1,2936 @@
+package org.musetest.selenium.values;%0A%0Aimport org.musetest.builtins.value.*;%0Aimport org.musetest.core.*;%0Aimport org.musetest.core.events.*;%0Aimport org.musetest.core.resource.*;%0Aimport org.musetest.core.values.*;%0Aimport org.musetest.core.values.descriptor.*;%0Aimport org.musetest.selenium.*;%0Aimport org.openqa.selenium.*;%0Aimport org.openqa.selenium.support.ui.*;%0A%0A/**%0A * @author Christopher L Merrill (see LICENSE.txt for license details)%0A */%0A@MuseTypeId(%22element-selected-label%22)%0A@MuseValueSourceName(%22Selected Label%22)%0A@MuseValueSourceTypeGroup(%22Element.Value%22)%0A@MuseValueSourceShortDescription(%22Returns the label of the selected choice in the elment%22)%0A@MuseValueSourceLongDescription(%22Resolves the supplied element source, verifies that it is a select element, then returns the label of the selected choice (if any).%22)%0A@MuseStringExpressionSupportImplementation(SelectedLabel.StringExpressionSupport.class)%0A@MuseSubsourceDescriptor(displayName = %22Element%22, description = %22The element to get value from%22, type = SubsourceDescriptor.Type.Single)%0A@SuppressWarnings(%22unused%22)  // instantiated via reflection%0Apublic class SelectedLabel extends BaseElementValueSource%0A    %7B%0A    @SuppressWarnings(%22unused%22)  // used via reflection%0A    public SelectedLabel(ValueSourceConfiguration config, MuseProject project) throws MuseInstantiationException%0A        %7B%0A        super(config, project);%0A        %7D%0A%0A    @Override%0A    public String resolveValue(MuseExecutionContext context) throws ValueSourceResolutionError%0A        %7B%0A        WebElement element = resolveElementSource(context, true);%0A        Select select;%0A        try%0A            %7B%0A            select = new Select(element);%0A            %7D%0A        catch (UnexpectedTagNameException e)%0A            %7B%0A            throw new ValueSourceResolutionError(String.format(%22The element must be a %3Cselect%3E - found a %25s%22, element.getTagName()));%0A            %7D%0A        String label = select.getFirstSelectedOption().getText();%0A        context.raiseEvent(ValueSourceResolvedEventType.create(getDescription(), label));%0A        return label;%0A        %7D%0A%0A    @Override%0A    public String getDescription()%0A        %7B%0A        return %22selectedLabel(%22 + getElementSource().getDescription() + %22)%22;%0A        %7D%0A%0A    public final static String TYPE_ID = SelectedLabel.class.getAnnotation(MuseTypeId.class).value();%0A%0A    public static class StringExpressionSupport extends BaseArgumentedValueSourceStringSupport%0A        %7B%0A        @Override%0A        public String getName()%0A            %7B%0A            return %22selectedLabel%22;%0A            %7D%0A%0A        @Override%0A        protected int getNumberArguments()%0A            %7B%0A            return 1;%0A            %7D%0A%0A        @Override%0A        protected String getTypeId()%0A            %7B%0A            return SelectedLabel.TYPE_ID;%0A            %7D%0A%0A        @Override%0A        protected boolean storeSingleArgumentAsSingleSubsource()%0A            %7B%0A            return true;%0A            %7D%0A        %7D%0A    %7D%0A

add selectedLabel()