chrome.devtools.inspectedWindow.eval to inspect element in Iframe (iframe without Iframe URL)
Reported by
sury...@gmail.com,
Aug 12 2016
|
|
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36 Steps to reproduce the problem: In my extension I am highlighting the node that I have XPATH for. the code below works if I have Iframe with URL hello.com var script = "var nodes = document.evaluate(\"" + issue.xpath + "\", document, null, XPathResult.ANY_TYPE, null);" + "var node = nodes.iterateNext();" + "if(node){" + "inspect(node);" + "}" chrome.devtools.inspectedWindow.eval(script, { frameURL: }); What is the expected behavior? I would expect that the same work for the Iframe WITH OUT url. For example the following html has iframe without URL. <html> <head> </head> <body> <h2>Main Page</h2> <iframe id="Iframe" title="my Iframe"> <html> <head> </head> <body> <h2>Iframe</h2> </body> </html> </iframe> </body> </html> What went wrong? Does not inspect. Did this work before? No Chrome version: 51.0.2704.106 Channel: n/a OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version: Shockwave Flash 22.0 r0 Also, how can we differentiate two iframes with same URL |
|
►
Sign in to add a comment |
|
Comment 1 by l...@chromium.org
, Aug 15 2016Status: Assigned (was: Unconfirmed)
Hi surya66@, thanks for the report. I was able to repro a failure with a small HTML file with an iframe with these steps: 1 Open console and enter: 2 var node = document.evaluate('/html/body//iframe', document, null, XPathResult.ANY_TYPE, null).iterateNext() 3 Enter 'inspect(node)' 4 Receive 'Uncaught ReferenceError: node is not defined' error What happens after step 2 is the execution context switches from 'top' to 'iframe', where node isn't defined. Joel, can you check whether this is intended behavior or not? In the meantime, you can workaround this by writing the script as a one-liner that should execute in the 'top' context inspect(document.evaluate('/html/body//iframe', document, null, XPathResult.ANY_TYPE, null).iterateNext())