我有以下HTML:
<label for="file-input-76eb2" id="ember3042" class="c-text-input c-text-input o-grid-cell--6 file-upload ember-view">
<input id="file-input-76eb2" type="file" accept="text/csv" style="display: none;">
<span class="c-file-upload__input-filename"></span>
<a class="c-button c-button--single-action-primary c-file-upload__input-button">
Select
</a>
</label>我已经设法获得了对应于标签标签的Capybara::Node:Element,但我无法访问输入。id是动态的--不断变化。此外,我需要将文件上传到此输入标记。
有什么我能做的信息吗?这都是使用google-chrome-headless实现的。
这是使用Ruby、Capybara和Selenium。
发布于 2017-11-30 07:17:09
看起来像
label_element.find(:xpath,'//input')做到了!
https://stackoverflow.com/questions/47563049
复制相似问题