-2

I need to read the contents of a browser window from a console application in C#.

What is the best way to do it.

I'm trying to use Automation UI (by capturing process of the browser and creating a AutomationElement of that process) but since I'm very new to this concept. I don't know where to begin from.

  • What kind of browser would be used? – Alexander Balte Jan 10 '13 at 04:50
  • any kind. need read the content of the browser window through process – Prabesh Manandhar Jan 10 '13 at 04:52
  • You can try using Selenium WebDriver: http://seleniumhq.org/docs/03_webdriver.jsp – Matthew Jan 10 '13 at 04:56
  • @Matthew - Selenium works great if you're writing code to automate the browser that's fully under the control of some test code (eg. open a specific page and use/test it); but AFAIK not so useful if you want to snoop on browser apps that are already running. – BrendanMcK Jan 10 '13 at 10:23
  • Prabesh, can you perhaps add more details to your scenario - what type of processing or parsing do you want to do if/when you detect that a certain page has been loaded? – BrendanMcK Jan 10 '13 at 10:29
  • A since-deleted answer mentioned HTMLAgility; that approach could work *if* you can extract the URL from the currently-running browser, and so long as the page doesn't rely on cookies or javascript - then you could load and parse a separate copy of the page yourself rather than accessing the existing DOM. But that depends on your specific scenario. – BrendanMcK Jan 10 '13 at 11:04

1 Answers1

2

I understand what you are trying to accomplish but please be also noting that AutomationElement works only with some browsers, not all, among which Opera is to be shot down first.