我想使用selenium webdriver java从Web应用程序下载文件。
我的方案是从锚标记获取下载URL,但它没有直接href而是触发javascript onclick事件。
我不知道如何从上面获取URL,因为我们点击元素后会生成URL。在搜索时,我发现,我们可以使用事件处理程序在我们的代码中执行onclick函数,但是也不知道有关它的明确信息。
同时,我必须维护会话以下载文件。我在下面提到了同样的内容。
我的锚标记如下所示:
UserControl
Javascript功能:viewAttachment:
<a class="btn btn-link withIcons btn-download" id="diversityCertxlsx" tabindex="333" onclick="javascript:viewAttachment('91779459');" role="button" data-bind-enter="true"><i class="phx phxGlyph halflings halflings-download-alt" role="img" id="halflingshalflings-download-alt"></i> <span class="linkText">diversityCert.xlsx</span></a>
提供/建议我一个解决方案。
谢谢