0

Im struggling to find an input field in html, I can fill out every input field with the following code:

public async Task FillElementAsync(By by, string arg)
        {
            WebDriverWait wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(20));
            IWebElement myDynamicElement = wait.Until<IWebElement>((d) =>
            {
                return d.FindElement(by);
            });
            myDynamicElement.SendKeys(arg);
        }

But when I try to fill out this input, I cant focus the element:

<span class="center-block">
   <sprd-label-input model="">
      <div class="label-input-wrapper" ng-class="{'active': focused || !!inputValue.length || !!modelValue.length || placeholderExists, 'filled': inputValue.length || modelValue.length}" ng-transclude="">
         <div ng-model="idea.getCurrentTranslation().tags" sprd-validate-tags="idea" blacklist-result="tagsBlacklist" name="tags" class="ng-pristine ng-untouched ng-valid ng-not-empty ng-valid-tags ng-valid-blacklist"></div>
         <label for="design-detail-tags" class="text-medium-grey">Stichwörter</label>
         <!---->
         <sprd-tag-input ng-model="idea.getCurrentTranslation().tags" idea-name="idea.getCurrentTranslation().name" display-tags-left="true" display-related-tags="true" display-error-text="form.$error.tags" blacklist-result="tagsBlacklist" id="input-design-tags" name="designTags" class="ng-pristine ng-untouched ng-valid ng-not-empty">
            <div class="clearfix">
               <!---->
               <div class="tag-input-container form-control clearfix" focus-input-on-click="" remove-on-backspace="ngModel">
                  <!---->
                  <input ng-model="TagInputCtrl.tagInput" uib-typeahead="tagSuggestion for tagSuggestion in TagInputCtrl.getTagSuggestions($viewValue)" class="pull-left ng-pristine ng-untouched ng-valid ng-empty" select-on-comma="" select-on-whitespace="" select-on-blur="" typeahead-focus-first="false" tag-select="TagInputCtrl.onEnter" tag-select-model="ngModel" sprd-max-input-length="50" ng-show="ngModel.length < TagInputCtrl.validatorOptions.tags.max" aria-autocomplete="list" aria-expanded="false" aria-owns="typeahead-2871-1170" type="text">
                  <ul class="dropdown-menu ng-hide" ng-show="isOpen() &amp;&amp; !moveInProgress" ng-style="{top: position().top+'px', left: position().left+'px'}" role="listbox" aria-hidden="true" uib-typeahead-popup="" id="typeahead-2871-1170" matches="matches" active="activeIdx" select="select(activeIdx, evt)" move-in-progress="moveInProgress" query="query" position="position" assign-is-open="assignIsOpen(isOpen)" debounce="debounceUpdate" style="">
                     <!---->
                  </ul>
               </div>
               <!---->
               <p ng-if="displayTagsLeft" class="pull-right">
                  <small class="design-tags-left">noch 25 Stichwörter</small>
               </p>
               <!---->
               <!---->
               <div ng-if="displayRelatedTags" class="form-group clearfix tag-input-related-tags ng-hide" ng-show="TagInputCtrl.relatedTags.length > 0">
                  <p class="label-description pull-left" style="margin-top: 3px;">Vorschläge für Stichwörter:</p>
                  <ul class="list-inline related-tags-list pull-left">
                     <!---->
                  </ul>
               </div>
               <!---->
            </div>
         </sprd-tag-input>
      </div>
   </sprd-label-input>
</span>

I tried to find the element by ClassName ("tag-input-container"), by ID ("input-design-tags") and by name ("designTags"). So my qustion is why, whats so special on this input type besides the autocomplete function?

3
  • 1
    try ByCssSelector("input [ng-model='TagInputCtrl.tagInput']") and if element needs to be active before sending keys then you might need to hover-over or click on element Commented Jul 16, 2018 at 20:06
  • Not related directly to the question, but rather a side comment: Is there a reason you declared this method async? I suppose not, because you don't await anything. Commented Jul 17, 2018 at 19:14
  • To keep UI responsive. You are right I deleted this line of code for simplicity: await JustWaitForXSeconds(5); Commented Jul 17, 2018 at 19:17

1 Answer 1

1

You should make sure you are sending keys to the input element here, not the sprd-tag-input element.

FillElementAsync(By.CssSelector("#input-design-tags input"), "test")

Note that you might need to first click the sprd-tag-input element to activate the input.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.