我在页面上有以下代码:
<div class="col-md-5 col-lg-3">
<div class="react-selectize bootstrap3 root-node simple-select open">
<div class="react-selectize-control">
<div class="react-selectize-placeholder">testing!</div>
<div class="react-selectize-search-field-and-selected-values">
<input class="resizable-input" style="width: 4px;" type="input">
如果我物理选择输入字段,然后使用 watir-classic 运行以下命令:
BROWSER.div(:class => 'col-md-5 col-lg-3')
.div(:class => 'react-selectize-search-field-and-selected-values')
.text_field(:class => 'resizable-input')
.send_keys('Magg')
它将进入Magg
该字段,但如果我不手动选择该字段,我似乎无法等待输入文本。
我尝试了以下方法:
BROWSER.div(:class => 'col-md-5 col-lg-3')
.div(:class => 'react-selectize-search-field-and-selected-values')
.text_field(:class => 'resizable-input')
和
.set('Magg')
.fire_event('onfocus')
.fire_event('mousedown')
.fire_event('mouseup')
使用
.parent.text_field(:class => 'resizable-input')
.parent.input(:class => 'resizable-input').set('Magg')
.input(:class => 'resizable-input').set('Magg')
.input(:class => 'resizable-input').send_keys('Magg')
我一直在与使用控件的开发人员合作,我们都无法弄清楚如何赋予控件焦点,以便在send_keys
不手动选择控件的情况下工作。任何指导将不胜感激。