473,587 Members | 2,316 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.Interne tExplorer ie = new SHDocVw.Interne tExplorerClass( );
SHDocVw.IWebBro wserApp ObjBrowser = (SHDocVw.IWebBr owserApp)ie;
ObjBrowser.Visi ble = true;
object noValue = System.Reflecti on.Missing.Valu e;
object noValue1 = System.Reflecti on.Missing.Valu e;
ie.Navigate("ht tp://www,blablabla.c om", ref noValue, ref noValue, ref
noValue, ref noValue);
WaitForReadySta te(); 'Not included in this example
HTMLDocument document = ((HTMLDocument) ie.Document);
HTMLInputElemen t button =
(HTMLInputEleme nt)document.get ElementById("My ButtonId");
button.click(); // This close the current win and open a new one
WaitForReadySta te();
// 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("I nternetExplorer .Application")
ObjBrowser.Visi ble = TRUE
ObjBrowser.Navi gate("http://www.blablabla.c om")
WaitUntilPageIs Loaded
set ObjDocument = ObjBrowser.docu ment
ObjDocument.Get ElementById("My ButtonId").Clic k
WaitUntilPageIs Loaded
Set AllIE = CreateObject("S hell.Applicatio n")
dim x
for x=0 to AllIE.windows.C ount-1
if inStr(AllIE.win dows(x).locatio nUrl,"TheExpect edPage.asp")>0
then
'msgbox "found = "+AllIE.windows (x).locationUrl
exit for
end if
next x
set ObjBrowser=AllI E.windows(x) '** HOW TO DO THIS WITH C# ???
****
set ObjDocument = ObjBrowser.docu ment ** HOW TO DO THIS WITH
C# ??? ****
msgbox ObjDocument.bod y.innerHtml

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

Thanks!

Apr 8 '07 #1
1 3498
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
2669
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 Internet Explorer in it then will it cause an error if version Internet Explorer is the same one as WebBrowser which is in my project? Is it this control...
1
21013
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 6.2 but Internet Explorer and Opera just seem to ignore the XY coordinates. Any idea on how to make it work?
2
3872
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 http://home.pacific.net.sg/~jacksony ? (the drop down bar could not work at www.apchosting.net but can drop at home.pacific.net.sg. I suspect it is a server problem but was told it...
0
995
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 there anyway to configure the size of the debug Internet Explorer window from within Visual Studio? In FrontPage, you can configure exactly how big you...
9
3098
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
934
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 another in the same window without opening new window like for example from www.msn.com to www.yahoo.com ? because I have this code which open...
7
4490
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 Microsoft Internet Control refreance to my project ? some body toled me to use ShellExcute Function in API but I tried it
11
11604
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 in the datagrid). It will automatically print that web page, and then it will close the Internet Explorer window. I have code that works...
1
1072
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 focus and display it on top. After a certain length of time I want the Internet Explorer window to lose focus, go to back and minimize.
2
3141
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 message as in alert box as " Internet Explorer cannot open the Internet site http://google.citycarrentals.com.au/viewalllocations.php . Operation...
0
7915
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8339
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
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 we have to send another system
0
1185
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.