printing out the URL of each frame in html
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
printing out the URL of each frame in html
I need help printing out the url of frames in an html document. Below is my script (foo.ps1) which prints the url of the document (foo.html). I have spent a couple of hours trying to add the appropriate code to access the url of the documents within the frames. I have tries stuff like:@($doc.frames)[0].document.url@($doc.frames)[test].document.url$doc.getElementById("test").document.urletc etc etcI would appreciate anyones help in the proper code needed to access the objects/elements within the frame of a html document.foo.ps1#########################$ie = new-object -comobject "InternetExplorer.Application"$ie.visible = $true$ie.navigate("file:///C:/Users/Jason/Desktop/foo.html")start-sleep -m 1000$doc=$ie.document$doc.url#########################foo.html**************************************<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN"><HTML><HEAD><TITLE>My Framz Page- The Master Page</TITLE><META http-equiv=Content-Type content="text/html; charset=windows-1252"><META content="MSHTML 6.00.6000.16643" name=GENERATOR></HEAD><FRAMESET cols=50%,50%><FRAME NAME=test id=test src="http://www.pagetutor.com/frames_tutor/e ... ml"><FRAME src="http://www.pagetutor.com/frames_tutor/e ... SET></HTML>***********************************************************************
printing out the URL of each frame in html
YOu might consider changing the way you do this entirely - it might be easier just to get the base document and use a regex to grab the src's from the HTML tags. Then load each page individually. IE has a lot of security surrounding frames that can make them pretty complex, and the COM object doesn't adapt 100% well into .NET.
printing out the URL of each frame in html
Hey Jvieera,Tried to access frame but was unable to get anywhere even with a local page. Thanks for the suggestions.
printing out the URL of each frame in html
Hey All,I was able to finally do it with the help you two provided. My new script is as follow:##########################################################$ie = new-object -comobject "InternetExplorer.Application"$ie.visible = $true$ie.navigate("file:///C:/Users/Jason/Desktop/foo.html")start-sleep -m 3000@(@($ie.document.getElementsByTagName("frameset"))[0].getElementsByTagName("frame"))[0].src@(@($ie.document.getElementsByTagName("frameset"))[0].getElementsByTagName("frame"))[1].src##################################################################