-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
hi
how can make cockies dedicated from internet explorer ?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I have no idea what that statement means.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Quote:
Originally Posted by
kleinma
I have no idea what that statement means.
tnx mate
but it means i need login to gmail for example via m
and i dont want if anybody open IE and type Gmail.com can use my session on gmail :)
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I still have no idea what you are asking for. I'm sorry. You really need to state your intent clearly and use full words.
"for example via m" doesn't mean anything to me...
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Quote:
Originally Posted by
kleinma
I still have no idea what you are asking for. I'm sorry. You really need to state your intent clearly and use full words.
"for example via m" doesn't mean anything to me...
:(
"via m " in fact was :via my application" . it was my fault . sorry
i said ur application used IE coockies . and coockies in ur application and IE is same .
how can we segregate these coockies ?
and ur programms dont use IE coockies and IE dont use ur Program Cookies
is it cleary ?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
is it cleary? well not really, but if you are asking about why COOKIES (not cockies, and not coockies) are the same in IE and the same in an app you make when using the webbrowser control, that is because they are one in the same. IE and the browser control use many common things, including settings. This is because the browser control is nothing but a part of IE that Microsoft exposes for you to use in your applications.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hey kleinma,
First of all tnx alot for your project because it was very helpful :)
I managed to fill in textboxes but i have some problems regarding submit button.
First of all here is the site i am working with:
https://weblogin.runescape.com/login...mentoptions.ws
1) I could not find Mshtml as a reference in the .net framework. (you need to download?)
2) Submit button didnt work for me
3) How can i do all this with web request and using a proxy?
Tnx alot :)
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
wow hope you're still reading this kleinma! this thread is priceless!
I have a DVR (digital video recorder) that I am able to log in to via browser to view the cameras. I have successfully logged in once using your provided code which takes me to a second page.
I'm having a problem where, if I click the Submit button manually, it works fine. If I let my code do it (which worked the first time I ran the program), it gives me this "error": "Session ID removed from recorder & browser. " which is specific to the DVR, not IE.
Is it cookies or something that needs to be cleared before loading the page? I'm not sure why it worked the first time, then when I relaunched the program, it is basically telling me my login "timed out"
Thoughts?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Thanks for this thread, kleinma! It's been very helpful and it's great thing that you share your knowledge.
Now, to my topic. I need to retrieve anchor text from all links on some website, which contain specified string like "?seed=". The example HTML code:
Code:
<div class="tablename">
<h2>blast</h2><table summary="Keywords"><thead><tr><th colspan="2" style="background-color: #505D71">3,886 searches (top 100 only)</th></tr><tr><th width="5%">Searches</th><th class="keyword" width="94%">Keyword</th></tr></thead><tfoot><tr><td>3,886</td><td>total searches</td></tr></tfoot><tbody><tr><td>380</td><td><a href="?seed=scrabble+blast&adult_filter=remove_offensive">scrabble blast</a></td></tr><tr><td>360</td><td><a href="?seed=blast&adult_filter=remove_offensive">blast</a>
Now, as you see, links don't have any id's, so it needs to be done by searching the specified string within all links on the website, check if they contain string and then get only the text, like from :
Code:
<a href="?seed=scrabble+blast&adult_filter=remove_offensive">scrabble blast</a>
I need to get only the words "scrabble blast" and do the same to all links on the website.
Now I have the code below, which doesn't work, I use standard WebBrowser from .NET 2.0. When I remove "TextBox2.Text &" from "TextBox2.Text & (element.OuterText) & vbCrLf" it gets text only from the last link on that website. When I run this one here, the app hangs my PC.
Code:
Dim i As Integer
For i = 0 To WebBrowser1.Document.Links.Count - 1
For Each element As HtmlElement In WebBrowser1.Document.Links
If element.GetAttribute("href").Contains("?seed=") Then
TextBox2.Text = TextBox2.Text & (element.OuterText) & vbCrLf
End If
Next
Next
And also, I have a question - will it be working better if I use Regex? First, download the HTML source and then use Regex to retrieve what I want?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
when i submit a unicode/ascii thingy eg. ★ string, it will display garbage character in the form response. The client program can display the program very well but not the server form.
Do i need to do some conversion, i tried something like
DirectCast(GetCurrentWebForm.item("varName"), mshtml.HTMLInputElement).value = System.Text.Encoding.ASCII.GetString(System.Text.Encoding.unicode.GetBytes("★"))
but it came out other type of character instead.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
How can we supress msgbox button on a webpage?
For example, there is a delete button on a webpage to delete something. However when you click this button it reconfirms before deleting the thing. It pops up a msgbox stating "Are you sure you want to delete the thing?" With Ok or Cancel button.
I do not want to disclose this button to the user and want to press ok button through my program coding. Or lets say when we click on logout on this website it display a msgbox to confirm it first. Is there any way to do supress this box and press ok through program?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I had done some example code about supressing an alert box, you may be able to use it to do the same for a confirm box as well.
Another approach that SOMETIMES works (it all depends on the site) is to look at exactly what the button does when you click it. For example if the page is setup in such a way that when the button is clicked, it calls a JS routine to confirm with the messagebox, and as long as the JS routine returns true, it submits the form, then you could just directly submit the form via code. Again that all depends on how the specific page is setup and works.
Just note anything I do is in .NET, I notice your user name looks like you use VB6.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
It's good to know that this thread is still alive :)
Is there any way to check if certain JS script has finished executing, sort of like "DocumentCompleted" event for page loading? Because DocumentCompleted doesn't work with javascript - there's no way to check if script has finished executing and the data are loaded. I'm using VB.NET 2005. Any help will be appreciated, thanks.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
There is nothing I am currently aware of that would allow you to know when javascript has finished executing, other than if there was something on the page you could keep polling and querying that could tell you.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Thanks for the reply. Too bad...right now I'm doing the way you suggested (checking for specific text on page), but it's not really reliable and elegant method.
EDIT: Actually, I've just "discovered" WAY simpler method for checking if JS has finished. It's way better than actually looking through text with MSHTML TextRange (for my needs). InnerHtml method converts the current doc into plain html, thanks to that we can check if specific html element or text has already been loaded by Javascript. You can put the method in Timer or some loop. I'm pasting it here in case anyone needed it:
Code:
If WebBrowser1.Document.Body.InnerHtml.Contains("html element name or text ") = True Then
Timer1.Enabled = False
' code for saving elements from webpage - whatever you want to do with it :)
End If
Sorry for a little chaotic post, but I'm really excited right now LOL :D I've been fighting with this **** for like 2 days to solve it :P I guess I've tried to complicate things which are plain simple. And THANKS KLEINMA again for showing me the beautiful world of WebBrowser in VB.NET :D LOL
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
is there a way to open a new instance or browser or change the default browser to firefox?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi, I have a little big trouble with C#, here it goes>
*************************htm code
<FORM onsubmit=centerMap() action=javascript:void(0) >
<INPUT id=txtAddress >
<INPUT type=submit>
</FORM>
**************************************C# code to click on for submit..
webBrowser1.Document.Forms[0].InvokeMember("onsubmit");// it really works!!!
BUTT!!!!!!!! if I had this htm code in the same file.htm*********************
<TABLE>
<TBODY>
<TR>
<TD align=right>Latitud:</TD>
<TD><INPUT class=inputField id=txtLatitude></TD></TR>
<TR>
<TD align=right>Longitud:</TD>
<TD><INPUT class=inputField id=txtLongitude></TD></TR>
<TR>
<TD align=right>Nivel mínimo de acercamiento:</TD>
<TD>
<INPUT id=txtLevel size=3 value=3> <INPUT onclick=addPoint() type=button>
</TD>
</TR>
<TR>
<TD align=right colSpan=2></TD>
</TR>
</TBODY>
</TABLE>
*****************************I can't simulate the click event, I tried with...
webBrowser1.Document.Forms[0].InvokeMember("onclick");//fail!! I think the problem is there is no form on this part of the code, so I can't perform that...what I know that works is "webBrowser1.Document.???????????.InvokeMember("onclick");" I made some test and this is what I got. Somebody I need some help!!!!!!
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
It looks to me like addPoint() is just a javascript function defined somewhere else in the HTML. Why not just make a direct call to addPoint() ? My example code download shows how to execute javascript directly.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
@sonicsx: Check this out...maybe it'll work in your case too...I use it javascript based form
vb Code:
For Each element2 As HtmlElement In wb.Document.GetElementsByTagName("input")
If element2.GetAttribute("onclick") = "addPoint()" Then element2.InvokeMember("click")
Next
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
kleinma I a noob to vb.net and visual studio, I have a couple of questions I hope you can answer.
Can your code for filling a textarea be used for the regular webbrowser?
Also how do we add the browser from your project to a new project?
Also in a new project I created when I use "mshtml.HTMLTextAreaElement" in your code, visual studios say it is not defined, but this not a problem when I load your project. What could be the reason for this?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
1) regular webbrowser? what is a "regular" webbrowser (other than one that is not google chrome ;)) Do you mean the standalone IE browser, and not the webbrowser control that you would put on your own form? The answer is no, you can't. You can, but it requires you to write a plugin to IE, not just write code in a VB.NET app that uses a browser control.
2) Right click on your toolbox and select "choose items", the go get coffee while that dialog box loads, and the click the COM Components tab, and find "Microsoft Web Browser" and check it off. This should add the COM browser to your toolbox. Note it does not replace the managed .NET browser.
3) do you have a reference to mshtml set? Do you even have mshtml.dll on your computer? You may need to search for it. I am pretty certain somewhere above in the last 430 posts there is a link to download it if needed ;)
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Thank you for responding kleinma. :)
So then would this work on the webbroswer control that go on the form?
As for mshtml.dll I have the file, but I didn't have a reference set to mshtml.
Quote:
Originally Posted by
kleinma
1) regular webbrowser? what is a "regular" webbrowser (other than one that is not google chrome ;)) Do you mean the standalone IE browser, and not the webbrowser control that you would put on your own form? The answer is no, you can't. You can, but it requires you to write a plugin to IE, not just write code in a VB.NET app that uses a browser control.
2) Right click on your toolbox and select "choose items", the go get coffee while that dialog box loads, and the click the COM Components tab, and find "Microsoft Web Browser" and check it off. This should add the COM browser to your toolbox. Note it does not replace the managed .NET browser.
3) do you have a reference to mshtml set? Do you even have mshtml.dll on your computer? You may need to search for it. I am pretty certain somewhere above in the last 430 posts there is a link to download it if needed ;)
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
kleinma --
Are there any ways to perform browser manipulation on Compact Framework 3.5? I'm looking to auto-login to a website on a Mobile 6 phone. Your .net demo app was great and is exactly what I was looking for a example but I'm working with the compact framework..Any help would be GREATLY Appreciated. I have the skeleton of my app built but can't get pass this problem.
Thanks!
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
First of all,let me THANK you for providing WebpageManupilation code.I am a beginner in VB.net and I found the mshtml method extremely easy and understandable.
I am creating an autosurfing application(where the application automatically surfs webpages and fills in information) to make my work simple.
Now my application using your WebpageManupilation methods which works perfectly on phpBB boards.
However on vBullettin boards it is giving me some problems
Here is my code for entering some info in a form for submitting new thread
VB.NET Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DirectCast(GetCurrentWebForm.item("subject"), mshtml.HTMLInputElement).value = "Sunny" 'this TOTALLY DOESNT WORK GIVES ERROR
wb.Document.All("subject").setAttribute("value", "sdsdsdsdsd") ' this WORKS!!!
wb.Document.All("message").setAttribute("value", "sdsdsdsdsd") ' this DOESNT WORK but no ERROR
TextBox1.Text = wb.Document.All("preview").getAttribute("name")
'DirectCast(GetCurrentWebForm.item("message"), mshtml.HTMLTextAreaElement).value = "Sunny"
'DirectCast(GetCurrentWebForm.item("cmdSubmitMe", 0), mshtml.HTMLButtonElement).click()
'GetCurrentWebForm.submit()
End Sub
The error I get is "Object reference not set to an instance of an object."
the code
vb.net Code:
wb.Document.All("subject").setAttribute("value", "sdsdsdsdsd") ' this WORKS!!!
wb.Document.All("message").setAttribute("value", "sdsdsdsdsd")
somewhat works but still the "message " field in the form doent fill up
The source code of of that form is exactly the same as the one use use to create a new topic in this forum(since its a vBullettin board) except the textarea field is hidden and there is an addtional iframe under it(dunno what it does???)
Subject field
HTML Code:
<input class="bginput" type="text" tabindex="1" maxlength="90" size="40" value="" name="subject"/>
MEssage Field
HTML Code:
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr valign="top">
<td class="controlbar">
<textarea id="vB_Editor_001_textarea" dir="ltr" tabindex="1" style="display: none; width: 540px; height: 250px;" cols="60" rows="10" name="message"/>
<iframe id="vB_Editor_001_iframe" tabindex="1" style="border: 2px inset ; width: 540px; height: 250px;">
<html>
<head>
<style type="text/css">
1.wysiwyg { background: rgb(244, 244, 244) none repeat scroll 0% 0% !important; -moz-background-clip: border !important; -moz-background-origin: padding !important; -moz-background-inline-policy: continuous !important; color: rgb(0, 0, 0) !important; font-family: verdana,geneva,lucida,'lucida grande',arial,helvetica,sans-serif !important; font-style: normal !important; font-variant: normal !important; font-weight: normal !important; font-size: 10pt !important; line-height: normal !important; font-size-adjust: none !important; font-stretch: normal !important; -x-system-font: none !important; }
2 p { margin: 0px; } .inlineimg { vertical-align: middle; }
</style>
</head>
<body class="wysiwyg" spellcheck="true" linkifying="true" linkifycurrent="0" linkifymax="0">
<br/>
</body>
</html>
</iframe>
</td>
Somewhat I am having problems clicking "Submit post" and "Preview" buttons.
I dont understand why mshtml doesnt work??
Am I doing something wrong?? PLEASE HELP!!!
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
sounds like a bot, so I hope you don't plan to use this on vbforums vbulletin to make posts... ;)
GetCurrentWebForm if I remember correctly is sort of assuming that there is only 1 form on the page. If the page has more than 1 form, then you need to make sure you are grabbing the correct form that actually contains those fields you wish to fill in. wb.document.all() is going to search the entire DOM for the given field. So check that first and post back.
As far as the textarea issue, textareas have an innertext property to set I believe versus a value attribute.
Standard HTML is different for textareas..
<textarea>this is the text in the textarea box</textarea>
<input value="this is text in a textbox">
see the difference?
Let me know how you make out.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Yeah Thanks for replying....I checked out and indeed there were some hidden forms on the page so I had to change the index value to 3. Now things are working out smoothly except that the TEXTAREA problem still exists.
i tried innertext,innerHTML etc but nothing seems to work.The textarea simply doesnt fill in
I am really getting frustrated with this problem.Please could u have a look on my previous post #434 and see if u could find a solution
I guess the problem is the textarea field is hidden...Does that affect the program??
<td>
<textarea> '''' Its HIDDEN
</textarea>
<iframe>
<html>
</html>
</iframe>
</td>
GOD Knows whose value to set to get the message field filled up correctly.Thats the last of my problems bugging me now :(
P.S EDIT: Maybe I got the Problem but no solution till now.Maybe this will make things easier for u to find a solution
I found that the hidden textarea field value is only changed after submitting the post.However what really changes when I type my post,is the the value within the body tag which is inside the IFRAME.Maybe I need to set the Ifram's innertext but for some reason am not able to get to the iframe since it doesnt have a name only Id.I tried putting the ID but not Working...throws an exception
Here is an image I took with firebug working in action
http://i29.tinypic.com/21mxog7.jpg
Hope this makes it clear of my problem :cry:
-
Need help
:DSenerio: I am selecting values on the web page and clicking submit button via code and it returns a Excel sheet. I would like to be able via code get that file and place it in a designated folder.
For Each cdHTMLS In GetCurrentWebDoc.getElementsByTagName("input")
If cdHTMLS.type = "radio" And cdHTMLS.name = "ogrp" And cdHTMLS.value = "GW" Then
cdHTMLS.click()
Exit For
End If
Next
For Each cdHTMLS In GetCurrentWebDoc.getElementsByTagName("input")
If cdHTMLS.type = "radio" And cdHTMLS.name = "output" And cdHTMLS.value = "xls" Then
cdHTMLS.click()
Exit For
End If
Next
For Each cdHTMLS In GetCurrentWebDoc.getElementsByTagName("input")
If cdHTMLS.type = "submit" And cdHTMLS.value = "Submit" Then
cdHTMLS.click()
Exit For
End If
Next
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I am reading text from a webpage using the webrowser control. How do i read the value of the text in the "class" snippet below:
<div id="baseDiv" class="date-20090918 expired-info ">
I want my app to just get 20090918
My code snippet below does not seem to return the value
Code:
Dim theElementCollection As HtmlElementCollection = AxWebBrowser1.Document.GetElementsByTagName("div")
Dim controlName As String
For Each curElement As HtmlElement In theElementCollection
controlName = curElement.GetAttribute("id").ToString
If controlName = "baseDiv" Then
'this brings empty msg box
MsgBox(curElement.GetAttribute("class").ToString())
Return True
Exit Function
End If
Next
Any help is appreciated
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Use "classname" as the string instead of just "class". I know it doesn't make a ton of sense when the actual HTML just has a class attribute, but it works. ;)
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
sunnydsouza,
I have bee struggling with the same problem with the textarea's in the iframe. I only just worked it out today after countless frustrations on it. Here is the soltuion that seems to work:
Code:
WebBrowser1.Document.Window.Frames("vB_Editor_001_iframe").Document.Body.InnerHtml = "abc"
Allelulia !!!! I can't believe how hard this was to work out.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
psmith, that fills a textarea in an iframe, or just replaces the entire contents of the iframe with "abc" ??
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
kleinma,
For the latest vbulliten boards this will fill in the textarea. The reason being that they use javascript to copy the entire contents of the iframe into the textarea on the submit.
So to fill in the textarea for a Vbulliten board (only latest couple of versions) you can use the code I posted.
For most other textareas you can just find the textarea and set the value as per usual.
Hope that exlpains it a bit better.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Yeah that makes more sense.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Quote:
Originally Posted by
kleinma
Because your have elements all named the same thing (vehicle and sex) there is no way to simply grab one like you are doing and set a value. Trying to grab just one will just give you the first matching element. You need to grab them all, and loop them until you are on the element you want, then take action on it.
Radio buttons and Checkboxes often have the same name or id properties, so this is approach needed often when dealing with these.
First I use this subroutine to check/uncheck a radio or checkbox.
Code:
Private Sub ToggleHTMLCheckOrRadio(ByVal Checked As Boolean, ByVal CheckboxOrRadio As HtmlElement)
Try
If Checked Then
If Not Convert.ToBoolean(CheckboxOrRadio.GetAttribute("checked")) Then
CheckboxOrRadio.InvokeMember("click")
End If
Else
If Convert.ToBoolean(CheckboxOrRadio.GetAttribute("checked")) Then
CheckboxOrRadio.InvokeMember("click")
End If
End If
Catch ex As Exception
MessageBox.Show("Error occured toggling checkbox/radio: " & ex.Message)
End Try
End Sub
Then you need to call this code like so:
Code:
For Each RadioButton As HtmlElement In WebBrowser1.Document.All.GetElementsByName("sex")
If RadioButton.GetAttribute("value") = "male" Then
ToggleHTMLCheckOrRadio(True, RadioButton)
Exit For
End If
Next
For Each RadioButton As HtmlElement In WebBrowser1.Document.All.GetElementsByName("vehicle")
If RadioButton.GetAttribute("value") = "Bike" Then
ToggleHTMLCheckOrRadio(True, RadioButton)
Exit For
End If
Next
Notice how I grab all elements that match the given name/id. Then I loop them till I find the one with the correct value. Once I find that, I pass that element to the routine to check the checkbox or select the radio by invoking a click on it as if the mouse has clicked it.
I try the trick of the checkbox but it did not work with me if you can upload us an example to understand the idea please
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I have run into a problem.
I used your sample code to build a program that logs into a site. Navigates to a page I want, but now I am stuck.
There 4 groups of radio buttons and after checking the first set, depending on which one you clicked, some of the second set of radio buttons opens up.
I successfully managed to check the first radio button, but the second group doesn't open up.
Is there a way to send an actual click to it?
I have tried both of these methods.
vb Code:
DirectCast(wb.Document.all.item("fp1-1", 0), mshtml.HTMLOptionButtonElement).checked = True
DirectCast(wb.Document.all.item("fp1-1", 0), mshtml.HTMLOptionButtonElement).click()
Neither works.
I think it may have something to do with sending a javascript execution.
Here is the page source Im working with if that helps. Just the portion I think might be relevant.
Code:
<div class="nav_space" id="nav_space"></div>
<div id="view_all_cats_spacer" style="display: none;"></div>
<script src="https://images.associatedcontent.com/services/2.0.0/js/ac_ajax_win_takeover.js?v=68" type="text/javascript"></script>
<script src="https://images.associatedcontent.com/services/2.0.0/js/ac_call.js" type="text/javascript"></script>
<script LANGUAGE="JavaScript" TYPE="text/javascript" SRC="/include/classes/thirdparty/jspellEvolution/jspellEvolution.js" CHARSET="ISO-8859-1"></script>
<script LANGUAGE="JavaScript" TYPE="text/javascript" SRC="/include/classes/thirdparty/jspellEvolution/jspellSettings.js" CHARSET="ISO-8859-1"></script>
<div id="read_call" class="input_panel" style="display: none;"></div>
<div id="page_screen" style="display:none; "> </div>
<script language="javascript" type="text/javascript">
var goto ='/cms_edit_article.shtml';
var oAjaxWinTakeOver = new AjaxWinTakeOver("page_screen");
var oSearchResultPanel = new SearchResultPanel("read_call");
var oSearchResultRetriever = new SearchResultRetriever( "actions_call.shtml", 'call_detail_for_cp' , [oSearchResultPanel] );
String.prototype.trim = function() {
str = this.replace(/^\s+/, '');
return str.replace(/\s+$/, '');
};
function show( date ) {
if ( date == 'release_date' ) {
document.forms['articles'].release_date.value = '10/09/2009 09:19:03';
}else if ( date == 'expire_date' ) {
document.forms['articles'].expire_date.value = '10/09/2009 09:19:03';
}
}
function isCallRetain() {
var isChecked = 0;
}
function checkValue( form ) {
var elem = document.forms['articles'].elements;
var exclusiveExists = 0;
var distibutionExists = 0;
var paymentExists = 0;
var isExclusiveChecked = 0;
var isDistributionChecked = 0;
var isPaymentChecked = 0;
var isFilePresent = 0;
var isVideoGamePlatformChecked = 0;
var isVideoGraphicsAudioChecked = 0;
var isVideoGamePlaySelected = 0;
var isVideoCreativitySelected = 0;
var isVideoFunSelected = 0;
var isCountryUSA = 0;
var isState = 0;
if ($('prev_pub1') && $('prev_pub2')){ // exclusive
if ($('prev_pub1').checked == false && $('prev_pub2').checked == false){
alert('Please indicate whether you have previously published this content.');
return false;
}
}
if ($('fp1-1')){ // exclusive
exclusiveExists = 1;
if ($('fp1-1').checked == true){
isExclusiveChecked = 1;
}
}
if ($('fp1-0')){ // non-exclusive
exclusiveExists = 1;
if ($('fp1-0').checked == true){
isExclusiveChecked = 1;
}
}
if ($('fp1-2')){ // display only
exclusiveExists = 1;
if ($('fp1-2').checked == true){
isExclusiveChecked = 1;
}
}
if ($('syndication1')){ // distribution yes
distributionExists = 1;
if ($('syndication1').checked == true){
isDistributionChecked = 1;
}
} else {
isDistributionChecked = 1;
}
if ($('syndication2')){ // distribution no
distributionExists = 1;
if ($('syndication2').checked == true){
isDistributionChecked = 1;
}
} else {
isDistributionChecked = 1;
}
if ($('fp2-1')){ // upfront
paymentExists = 1;
if ($('fp2-1').checked == true){
isPaymentChecked = 1;
}
}
if ($('fp2-0')){ // perf
paymentExists = 1;
if ($('fp2-0').checked == true){
isPaymentChecked = 1;
}
}
if ($('fp2-00')){ // minor no pay
paymentExists = 1;
if ($('fp2-00').checked == true){
isPaymentChecked = 1;
}
}
if (isExclusiveChecked == 0 && exclusiveExists == 1){
alert('Please select which type of rights you would like to grant for this content.');
return false;
}
if (isDistributionChecked == 0 && distributionExists == 1){
alert('Please choose whether to make this content eligible for distribution with approved AC partners.');
return false;
}
if (isPaymentChecked == 0 && paymentExists == 1){
alert('Please select which type of payment you would like for this content.');
return false;
}
if ($('mast')){ // master license
if ($('mast').type != 'hidden'){
if ($('mast').checked == false){
alert('To continue, you must read and agree to the terms and conditions of the Master License Agreement by checking the box.');
return false;
}
}
}
if ($('wfh')){ // work for hire
if ($('wfh').checked == false){
alert('To continue, you must read and agree to the terms and conditions of the Work for Hire Agreement by checking the box.');
return false;
}
}
If they were all unlocked from the beginning I wouldn't have problems, but they are not.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi
I try to fill textarea on this page http://www.exbii.com/newthread.php?do=newthread&f=50
This code doesn’t work in my program
Code:
WebBrowser1.Document.Window.Frames("vB_Editor_001_iframe").Document.Body.InnerHtml = "abc"
or
WebBrowser1.Document.Window.Frames(2).Document.Body.InnerHtml = "abc"
I use VB 6.0 and WebBrowser. Can you help me and give corrected code
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Allex19,
Do you get an error ? or it just doesn't populate ?
-
1 Attachment(s)
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Yes I get error
“Object doesn’t support this property or method”
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Allex19,
What version are you using. The code posted has been tested on VB 2008 Express Edition. When I open your project it tells me I need to upgrade it so I assume your on an earlier version. I don't know the equivalent commands on the earlier versions.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I use the old version of Visual Basic 6.0
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
The smae premise should apply. You just need to work out the code. This is what you need to do:
Get the document object (DOM) from the webbrowser.
Find the frames in the DOM.
Find the frame called vB_Editor_001_iframe
Get the document from the frame
Set the body innerHtml to the value you want to put in the text area.
Thats pretty much it but I don't know the associated commands in the old vb 6.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Psmith65 thanks for your help. I decided to write a program in VB 2008
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hello, Can somebody explain who can i select all web document, in order to copy the html content?
I saw in WebpageManipulation code that is possible to find text in web page. but i want select all the web page.?
thanks in advance,
cafc
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
You just want to get all the HTML from a give page?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
but i am not interested in html code... because its doesn't show the information that i what!
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
You need to explain a bit more then. You state you want all the HTML from a given page, and then you say you are not interested in the HTML code. It can't be both.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
ok! i want get the data from a web page and not the html! there a lot of samples on internet to get/parser html! but none of them works in my case because the page that i want get data is a bit more complex... so i want use a object like webrowser or other and then select all the content of page in order to extract the data?
this is your code... what I want is to select all text on web page to get the data, instead of finding a specific string, do you understand what i mean?
Dim MyRange As mshtml.IHTMLTxtRange = Nothing
MyRange = DirectCast(mydoc.selection().createRange, mshtml.IHTMLTxtRange)
If MyRange.findText(Text) Then
MyRange.select()
Return True
Else
Return False
End If
thank you very much
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
If you just want to grab ALL the text from a webpage, then I would just consider grabbing the value of
WebbrowserInstanceName.Document.Body.InnerText
This is different from InnerHTML which will actually contain HTML markup code. The InnerText property ONLY returns text rendered in the HTML, the stuff visible on the screen.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
thanks for yours answers!
If i have this code for instance:
webBrowser1.Navigate("http://www.yahoo.com");
string q = webBrowser1.Document.Body.InnerText;
the variable q will not contain all text present on yahoo webpage! for that reason i said that I wanted find a solution that select all the webpage to be possible to copy all text in the webpage!!
thanks again
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
cafc2,
You need to give it time to navigate to the webbrowser. You are hitting the web page while it is still loading (or not even started to load). It will be empty till the page has loaded. Do a quick search on waiting for the webbrowser to load and you will find some code to handle it.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hi!
Yes of course!!! in above code i forget to say that de second line of code is executed only when webpage on webbrowser is completed, ok? for that reason i said that the variable q "will not contain all content" it means that after the webpage is complete downloaded i get only a part of text of the yahoo webpage! i know this is situation a little bit complex.... thanks
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
i try this.... and also doesn't work at all....
WebBrowser1.Document.ExecCommand("SelectAll", False, Nothing)
WebBrowser1.Document.ExecCommand("Copy", False, Nothing)
neither this solution works on my webpage:
some webpage works.... for instance.... yahoo.com works well but not in my webpage....
CDO.MessageClass message = new CDO.MessageClass();
message.CreateMHTMLBody(url, CDO.CdoMHTMLFlags.cdoSuppressNone, "", "");
ADODB.Stream stream = message.GetStream();
stream.SaveToFile("c:\\test.mht", ADODB.SaveOptionsEnum.adSaveCreateOverWrite);
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Quote:
Originally Posted by
cafc2
Hi!
Yes of course!!! in above code i forget to say that de second line of code is executed only when webpage on webbrowser is completed, ok? for that reason i said that the variable q "will not contain all content" it means that after the webpage is complete downloaded i get only a part of text of the yahoo webpage! i know this is situation a little bit complex.... thanks
It looks to work fine for me.. maybe you aren't really using Yahoo and only used that as an example. Is the page you are trying to get all the text from a single frame page, or does it have multiple frames? Maybe it has IFrames on the page? If it is more than 1 frame, you would have to grab each one individually.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
yeah.... probably is that..
thank very much for yours quick answers....
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
Hello there, I'm having a small problem.
I'm trying a program that will go to this website:
http://weather.msfc.nasa.gov/GOES/goeseastconus.html
then it will input the cordinates in the lower box.
then once the page as been sucesfully loaded, I want to extract the url of the big Image to be hable to download it. ( its a school proyect )
I tried using your COM webbrowser component, and it worked perfectly until the page after you send the cordinates loads to ejecute the next code..
problem?
every comparation I try to make a "wait time" until the next page is load, seems to be ignored by the program, it doesnt fully load, so it always detects only the icons and not the full image.
(example, the page mentioned above, after entering the cordinates and applied the form, goes to this page http://weather.msfc.nasa.gov/cgi-bin/post-goes, this page will display a "close up" of the cordinates, and also a few icons, including the NOAA. )
your program-code does detect the icons just fine. but not the main Image.
I tried using :
Code:
While AxWebBrowser1.ReadyState = SHDocVw.tagREADYSTATE.READYSTATE_LOADING
Application.DoEvents()
End While
and the code seems to work, but its ignored. (I want to pause the program until everything as sucesfully load, this needs to be done by the component and not by timers, as the place where the program will be deployed as very lousy internet connection ).
then by switching to the normal VS2008 web browser component.
I cant seem to be hable to use your conversion to mshtml.htmlformerelement
the code of your program :
Code:
Private Function GetCurrentWebDoc() As mshtml.HTMLDocument
Try
Return DirectCast(wb.Document, mshtml.HTMLDocument)
Catch ex As Exception
Return Nothing
End Try
End Function
raises a warning of "Runtime might occur when converting system.windows.form.htmldocument to mshtml.htmldocument"
WB.document = document of the VS2008 Web browser component
also is there a way to do it all silently and not in the visible way?
Ie, be hable to "input" the cordinates silently and get the resulting html ( I've done html parsing to get the http address of the images, so thats not problem )
*addenum*
I tried using the way other people recommended here
using wb.isbusy = true along with the wb.readystate = 4.
and still doesnt work, somehow it skips it and trows instantly an instance error on the directcast part where I want to "select" a textbox in a form. (the page clearly hasnt fully loaded)
I also tried a few variants and still.
any suggestions?
Also is there a way to do this but "hidden" similar to what MC_F was suggesting?
the problem is, if use the "webbrowser (com one) document completed it works, but and enters the form data and submits, but its still not automated, I have to click anywhere in the com component to somehow "activate" it.
wich is weird, as I have it focused.
sorry for all the question, I'm in no way an expert in programming and I get confused quite easily.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I downloaded you WebPageManupulation zip file from your first post and ran it.But it gives an error when i open it saying :
"The selected file is not a valid Visual studio solution file".
i am using VS 2006.
ANyways,i use the following coding to get the element and manupulate it usually:
Code:
For Each ele In WebBrowser1.Document.getElementsByTagName("input")
If ele.Value = "Tag Name" Then ele.Click:
Next
But i don't know how can i disable certain images that i see on a webpage using this coding.
Any suggestion how i can disable certain images(not all) using this coding perhaps.
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
There is no such thing as VS2006
What do you mean by disable images? You mean just not show them?
-
Re: Manipulate/Change/Form Fill data in webpages using the Webbrowser control
I'm having trouble. I wan't to search a website for a certain MD5 hash checksum. The site is http://virustotal.com/buscaHash.html
If it finds results, how could I list them within a listbox?