1

I am trying to write code that loops through all the tag elements in a html page and gives the inner text of each tag,

Until now it works if the webpage has only one frame element. But if the webpage has 2 frames the control needs to switch to the new frame and needs to loop through all the tag elements inside that frame.

Currently I'm struck at switching between frames. By using the below line I'm able to get all the frame handlers in the page:

IList<Elements> frameElements= Find.AllByTagName("iframe");

Please help me with code that can switch the control between different frame contexts.

René Vogt
  • 43,056
  • 14
  • 77
  • 99
  • What class is *Find*? Is ist a FW class or one of your's? – Radinator Aug 02 '16 at 13:54
  • thanks for your interest on this question, Find is a built in class from c#, it searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire List. – user6636066 Aug 05 '16 at 15:09
  • What you can try is to load the html web page into a Document via WebClient.Document and get a HtmlDocument. `string html = webClient.DownloadString(url); var doc = new HtmlDocument(); doc.LoadHtml(html);` (http://stackoverflow.com/a/4935634/6635287) then you can access the elements via `doc.GetElementById(string)` since Id is unique in a html document (assuming that the frames have ids) you can work now with the frames – Radinator Aug 08 '16 at 05:58

0 Answers0