-
August 2nd, 2011, 01:14 PM
#1
.NET WebBrowser Control and JavaScript
Hello everyone,
I am working on a project where I have to automate the process of entering data through a website. I decided to use the WebBrowser control in .NET for this task.
The problem I am having is that when I try to click on certain buttons, nothing happens. After lookign at the HTML code, I saw a pattern. I can click on buttons where the input type is submit, but I have trouble with the buttons where input type is button and they only have an onclick attribute with javascript code.
I have also tried to use the InvokeScript() method, but that also does not work.
The only think I can think of is that JavaScript is disabled for the WebBrowser control.
Can anyone give me any ideas on how I might be able to resolve this issue?
-
August 2nd, 2011, 02:42 PM
#2
Re: .NET WebBrowser Control and JavaScript
WebBrowser control is the wrong approach. Trust me, I know. Did something similar to autoamtically fill a range of textboxes on a webpage. Have a look into the SHDocVw and the mshtml namespaces / libraries. Add a reference to them. ShDocVw you can find at :
C:\Windows\System32
And the mshtml you can find at :
C:\Program Files\Microsoft.NET\Primary InterOp Assemblies
Also include your using statements to reference these libraries.
Once done, you can manipulate the webpage ( HTMLDocument ) object through code.
-
August 2nd, 2011, 06:20 PM
#3
Re: .NET WebBrowser Control and JavaScript
I have heard of MSHTML, but what is SHDocVw?
-
August 3rd, 2011, 06:19 AM
#4
Re: .NET WebBrowser Control and JavaScript
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|