
but I can't.. I want to click this button automatically when I click my button1 in C# project.
Html Codes:
and I write:
private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Document.GetElementById("XOOPS_TOKEN_REQUEST").InvokeMember("click");
}
but this code doesn't work... Help me please..
you can find this finish button when you fill register form in this page:
http://sfj.grigori.org/register.php
Cheers...

Sam HobbsRank #108 · 20.5K reputationPosted Jan 21, 2012, 12:26 AM EST
When I go to that page, I see a Submit button but not a Finish button. So I am probably not able to tell you what to use but you probably do not want to use XOOPS_TOKEN_REQUEST.
Also, if it were me and I was having problems with the code, I would split the line into two or more lines. In you code, you call GetElementById then you call InvokeMember. If there is a problem with GetElementById then you might never know that there is a problem; your code might simply fail without warning. So you should first check the return value from GetElementById to ensure it works before calling InvokeMember.
VulpesRank #55 · 29.2K reputationPosted Jan 21, 2012, 4:09 AM EST
As there's no id or name attribute, I think you'll have to resort to iterating through the elements until you find one with a value attribute of 'Finish'. This code should do that:
}
Csharp Ninja96 reputationPosted Jan 21, 2012, 8:37 AM EST
@vulpes thank you very much bro. you are my hero hehehe :) I want to know C# just like you. please suggest me a good source.
Cheers..
Sam HobbsRank #108 · 20.5K reputationPosted Jan 21, 2012, 9:08 AM EST
There are other ways to find elements using the DOM. I would avoid going through all the elements using the all collection if possible. I would try to determine if I can navigate through the hierarchy of elements, but I would have to study the document to determine how to process that document. My code in article is an example of what I mean. You can look at the documentation to quickly determine that HtmlDocument.GetElementsByTagName can be used to get a collection of "input" tags and then you can look for one with a value attribute of "Finish" and a type attribute of "submit".
Csharp Ninja96 reputationPosted Jan 21, 2012, 9:26 AM EST
Edit Account
how can I click this Edit Account button?
how we can go to blablabla.php , blablabla.aspx , blablabla.html pages with c#?
Sam HobbsRank #108 · 20.5K reputationPosted Jan 21, 2012, 9:44 AM EST
webBrowser1.Navigate("http://sfj.grigori.org/edituser.php");
Hopefully it is that simple. It depends on the situation. There will be times when you might need to get all the anchors ("a" tags or elements) in a page, filter them somehow, then show a list to select from. Then when one of them is selected, your program could navigate to the page specified in the href. For example if a page shows some pictures; you could get all the links and then automatically download all links that are for pictures.
Csharp Ninja96 reputationPosted Jan 21, 2012, 9:56 AM EST
for example, we can do that with FORM=ACTION:edituser.php code in iMacros . but I don't know how can I do that with C#. I need it because I will use that code for my URL List. (for every sites)
Sam HobbsRank #108 · 20.5K reputationPosted Jan 21, 2012, 10:05 AM EST
I don't know what an action is. If you can explain what an action is in terms of HTML then I can probably explain ho to do it but I don't know what iMacros are.
Csharp Ninja96 reputationPosted Jan 21, 2012, 12:55 PM EST
for example, I want to go to /register.php page on any site homepage when I click button1.. what code should I write in button1 click event.
hey @Vulpes do you understand me? help me pls. thanks
Sam HobbsRank #108 · 20.5K reputationPosted Jan 21, 2012, 1:36 PM EST
Csharp Ninja96 reputationPosted Jan 21, 2012, 2:23 PM EST
Sam HobbsRank #108 · 20.5K reputationPosted Jan 21, 2012, 3:01 PM EST
I am still learning C# and .Net and many other things. Vulpes knows more about C# and .Net. I am also experienced with C++. Most of my professional experience was with COBOL, most of which was before Windows existed.
I have used other languages too of course.