gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 13:56:54 25 4
gpt4 key购买 nike

目前我正在尝试与下拉菜单进行交互,该菜单仅在单击后显示特定文本。

看看下面的示例图片: enter image description here

<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>

正如您在上图中看到的那样,单击该元素时文本是可见的,但是当我检查该元素时,我看不到任何下拉文本项?

我尝试了以下方法:

  • 点击元素 > 然后使用链接文本
  • 使用列表遍历元素
  • 点击元素然后尝试发送 key
  • 我也无法使用 select,正如您从 html 代码中看到的那样,它的构造不同。

有什么想法吗?

最佳答案

一个选项是:

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

HTML 中的某处也必须有一个列表,其中包含可供选择的选项。它可能不是输入的直接父项或子项。

关于javascript - 无法从特定的下拉菜单中选择项目(文本)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57098491/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com