问题描述
我已经使用react-select AsyncCreatable来使搜索提示成为记录。现在,我想使用Capybara为其编写一些集成测试。我不知道该怎么做。我尝试单击该元素并告诉水豚fill_in('node',with: 'text')
,但实际上没有运气。
我将Selenium
与:headless_chrome
一起使用。
我得到一个Selenium::WebDriver::Error::ElementnotinteractableError: element not interactable
我也尝试过设置find('#people_search_form_name').set('Vini')
。这没有中断,但是没有将文本添加到输入字段中。
有人对实现它有任何建议吗?
这是生成的html
<div class=" css-dyr6gj-container" id="people_search_form_name">
<div class="people_search_form_name__control css-yk16xz-control">
<div class="people_search_form_name__value-container css-g1d714-ValueContainer">
<div class="people_search_form_name__placeholder css-1wa3eu0-placeholder">Find people</div>
<div class="css-b8ldur-Input">
<div class="people_search_form_name__input" style="display: inline-block;">
<input autocapitalize="none" autocomplete="off" autocorrect="off" id="react-select-3-input" spellcheck="false" tabindex="0" type="text" aria-autocomplete="list" aria-label="Find people" value="" style="Box-sizing: content-Box; width: 2px; 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: 12.8px; font-family: FiraSans,-apple-system,system-ui,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-weight: 400; font-style: normal; letter-spacing: normal; text-transform: none;">
</div>
</div>
</div>
</div>
<div class="people_search_form_name__indicators css-1hb7zxy-IndicatorsContainer">
</div>
</div>
<input name="people_search_form[name]" type="hidden" value="">
</div>
我了解到一种实现此目标的方法是使用send_keys
。像
find('.addresses_search_form_name__input').send_keys('Margate road')
但不幸的是,这也不起作用。
Minitest::UnexpectedError: Selenium::WebDriver::Error::ElementnotinteractableError: element not interactable
(会话信息:headless chrome = 85.0.4183.121)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)