Javascript 为什么我松开了iframe的src?

Javascript 为什么我松开了iframe的src?,javascript,html,phantomjs,casperjs,Javascript,Html,Phantomjs,Casperjs,html中有一个iframe: <iframe id="iframeViewer3D" width="340" height="210" scrolling="no" src="/global/viewer.aspx?mode=3DWebGL&amp;xmp=-1-59-flexible_shaft_coupling_c172903000300.xmp&amp;previewCad=flexible_shaft_coupling_c172903000300&amp;

html中有一个iframe:

<iframe id="iframeViewer3D" width="340" height="210" scrolling="no" src="/global/viewer.aspx?mode=3DWebGL&amp;xmp=-1-59-flexible_shaft_coupling_c172903000300.xmp&amp;previewCad=flexible_shaft_coupling_c172903000300&amp;h=210&amp;w=340&amp;version=3&amp;Lang=en&amp;fwsid=3DCC&amp;CF=0&amp;PMLOG=1&amp;DisplayMode=small&amp;manId=ACCES"></iframe>
它返回不带src的html的一部分:

<iframe id=\"iframeViewer3D\" width=\"340\" height=\"210\" scrolling=\"no\"></iframe>


为什么src丢失以及如何获取此src?我猜这是因为将leeds链接到另一个域

您是否尝试过直接获取src值

var link = casper.getElementAttribute('#iframeViewer3D', 'src');

谢谢,但我的目标只是用src获取iframe标记,而不是导航到iframe。听起来有点像是稍后加载的“src”。在保存之前,请先试用一下。这应该是安全的:casper.waitForSelector(“#iframeViewer3D[src]”)现在返回一个错误“等待超时5000ms已过期,正在退出”。然后源(src)没有加载到phantomjs中,只是猜测原因。您可以通过搜索iframe中的元素或截图来查看iframe是否已加载。非常感谢!我按照您在第一篇文章中的建议做了:var link=casper.getElementAttribute('PartnerFrame','src');,但对于另一个父项iframe,得到了一个合适的结果。
var link = casper.getElementAttribute('#iframeViewer3D', 'src');