我有一个<button>
我点击了打开文件浏览器,点击了隐藏的<input type="file"
&gt;。 (我在输入上的change
事件上监听,以访问用户选择的文件。)
使用Protractor,如何在初次点击<button>
时检查文件浏览器是否已打开?
我没有曝光<input type="file"
&gt;的原因对于用户来说,是要对<button>
答案 0 :(得分:2)
这里的关键问题是你不需要检查是否正在打开文件对话框(实际上,selenium cannot control or check whether a file dialog is being opened) - 浏览器点击“文件”{{1}超出了你的申请范围。
相反,您可能需要检查一旦点击input
,就会在button
元素上触发“点击”事件。添加事件监听器并使用input
(未测试):
executeAsyncScript()