我正在运行一个简单的Capybara脚本,以便多次填写表单。但是,当我尝试点击基于JavaScript的链接时,我遇到了一些问题。
当我检查元素时,链接如下所示:
<a id="s_1_1_53_0" tabindex="4997" href='JavaScript:SWESubmitForm(document.SWEForm1_0,s_7,"s_1_1_53_0","")'>
Modify or cease services
</a>
我尝试过使用click_on(&#34; s_1_1_53_0&#34;),click_link(&#34; s_1_1_53_0&#34;),找到(&#34; s_1_1_53_0&#34;)。点击。我也尝试过使用链接文本等,直接从链接运行JavaScript,但没有运气。
页面源代码如下:
<html OT='SiebWebMainWindow'>
<head>
<script language="javascript">navigator.id = "1432641204";</script></head>
<script language="javascript">top._swescript = window;</script><script language="javascript" src="23016/scripts/rtcEditor.js"></script><script language="javascript" src="23016/scripts/swecommon_top.js"></script><script language="javascript" src="23016/scripts/swecommon.js"></script><script language="javascript" src="23016/scripts/navctrl.js"></script><script language="javascript" src="23016/scripts/sweutil_keyboard.js"></script><a id="jsIncludes"></a>
<script language="javascript" src="23016/scripts/swemessages_enu.js"></script>
<script>this.ConfirmDeleteMessage ='Are you sure you want to delete this record?'</script><script> this.focus(); </script>
<frameset rows='100%,*' border='0' frameborder='No' OnUnload=SWEUnloadApp("/start.swe","","")>
<frame name="_sweclient" title="" src="/start.swe?SWECmd=GetCachedFrame" marginheight='0' marginwidth='0' noresize scrolling='No'>
<frame name="_swe" title="" src="/start.swe?SWECmd=GetCachedFrame&" marginheight='0' marginwidth='0' noresize scrolling='No' tabindex=-1>
</frameset>
</html>
有关点击链接的最佳方式的任何想法?