473,511 Members | 17,577 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DOM problem with new internet explorer window

Ok i try to automate IE with the DOM, i usually do this with VB but i
need to integrate it to my C# application. Here is an example :
using mshtml;
using SHDocVw;

....

SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();
SHDocVw.IWebBrowserApp ObjBrowser = (SHDocVw.IWebBrowserApp)ie;
ObjBrowser.Visible = true;
object noValue = System.Reflection.Missing.Value;
object noValue1 = System.Reflection.Missing.Value;
ie.Navigate("http://www,blablabla.com", ref noValue, ref noValue, ref
noValue, ref noValue);
WaitForReadyState(); 'Not included in this example
HTMLDocument document = ((HTMLDocument)ie.Document);
HTMLInputElement button =
(HTMLInputElement)document.getElementById("MyButto nId");
button.click(); // This close the current win and open a new one
WaitForReadyState();
// Missing magick here to access to the DOM of the new windows //
MessageBox.Show(document.body.innerHTML);

I dont know how i can catch the new windows and being able to declare
it as a browser object.

I can do it with VB with the following code but i cant find the C#
equivalent :(

Set ObjBrowser = CreateObject("InternetExplorer.Application")
ObjBrowser.Visible = TRUE
ObjBrowser.Navigate("http://www.blablabla.com")
WaitUntilPageIsLoaded
set ObjDocument = ObjBrowser.document
ObjDocument.GetElementById("MyButtonId").Click
WaitUntilPageIsLoaded
Set AllIE = CreateObject("Shell.Application")
dim x
for x=0 to AllIE.windows.Count-1
if inStr(AllIE.windows(x).locationUrl,"TheExpectedPag e.asp")>0
then
'msgbox "found = "+AllIE.windows(x).locationUrl
exit for
end if
next x
set ObjBrowser=AllIE.windows(x) '** HOW TO DO THIS WITH C# ???
****
set ObjDocument = ObjBrowser.document ** HOW TO DO THIS WITH
C# ??? ****
msgbox ObjDocument.body.innerHtml

Any help, clues or examples?? I'm trying to figure how to do this
since hours.... I play with System.Diagnostics.Process.GetProcesses()
but I really dont know how to convert it to a usable browser object.

Thanks!

Apr 8 '07 #1
1 3493
OK I finally found how to make it with ShellWindows ...Thanks!


Apr 8 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2663
by: Raymond H. | last post by:
Hello, I create a vb4 project which can also naviger on Internet via the WebBrowser control which I put on my form. My question is: if this program is installed on a station having already...
1
21004
by: F | last post by:
I'm trying to open a window in a specific position of the screen with this script: window.open('window.htm','mywindow','width=250,height=350,screenX=20,screenY =100') it works with Netscape...
2
3854
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
0
982
by: Rob Nicholson | last post by:
When debugging an ASP.NET program, I keep having to maximise the Internet Explorer window to full screen (to check that the grid based controls layout okay at 1024x768 screen resolution). Is...
9
3089
by: Jensen bredal | last post by:
Is there any way i can view my web page in full screen mode? F11 still hhas the internet explorer tool bar. Many thanks in advance JB
0
930
by: Husam | last post by:
Hi EveryBody: Is there any way by using win32 api or adding refrence of Microsoft Internet Controls to my project, Can help me to change the address bar of internet explorer from one url to...
7
4486
by: husamal_ahmadi | last post by:
Hi everyBody: I have this question which really drive me cruzy, By using VB.Net: How can I let the internet explorer navigate in the same window either by using win32 API or by using...
11
11576
by: Wendy | last post by:
Hello, I have a program that does the following: When a user clicks on a row in a VB.NET datagrid, it will open a web page in Internet Explorer (that corresponds to that item in the selected row...
1
1069
by: =?Utf-8?B?bWFib25k?= | last post by:
Hi I'm running an app that has been designed in VB.Net. Also running is an Internet Explorer window. At a certain point in my app I want to maximize the Internet Explorer window, give it the...
2
3131
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
0
7245
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7144
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7427
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5069
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1577
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.