简体   繁体   English

无法从特定的下拉菜单中选择项目(文本)?

[英]Unable to select item (Text) from a specific drop down menu?

Currently I'm attempting to interact with a dropdown menu which only shows specific text once clicked. 目前,我正在尝试与一个下拉菜单进行交互,该菜单仅在单击后才显示特定文本。

Take a look at the following example image: 看下面的示例图像: 在此处输入图片说明

<div class="" style="display: inline-block;">
<input autocapitalize="none" autocomplete="off" autocorrect="off" id="react-select-2-input" spellcheck="false" tabindex="0" type="text" aria-autocomplete="list" value="" style="box-sizing: content-box; width: 4px; background: 0px center; border: 0px; font-size: inherit; opacity: 1; outline: 0px; padding: 0px; color: inherit;"><div style="position: absolute; top: 0px; left: 0px; visibility: hidden; height: 0px; overflow: scroll; white-space: pre; font-size: 12px; font-family: sans-serif; font-weight: 300; font-style: normal; letter-spacing: normal; text-transform: none;">
</div>
</div>

As you can see from the above image upon clicking on the element the text is visible however when I inspect the element, I'm unable to see any of the dropdown text items? 从上图可以看到,单击元素时文本是可见的,但是当我检查元素时,看不到任何下拉文本项?

I have tried the following: 我尝试了以下方法:

  • Clicking on the element > then using link text 单击元素>然后使用链接文本
  • Looping through the element using a List 使用列表遍历元素
  • Clicking on the element and then trying to send keys 单击元素,然后尝试发送密钥
  • Also I'm unable to use select as you can see from the html code its constructed differently. 另外,我无法使用select,正如您从html代码中看到的那样,其构造有所不同。

Any ideas? 有任何想法吗?

One option would be: 一种选择是:

yourOption = element(by.id('react-select-2-input')).
yourOption.Click();
yourOption.sendKeys(Keys.DOWN);
yourOption.sendKeys(Keys.RETURN);

There must be a List somewhere in the HTML too that will have the options in it to be able to select from. HTML的某处也必须有一个列表,该列表中将具有可供选择的选项。 It may not be a direct parent or child of the input. 它可能不是输入的直接父项或子项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM