1

What I'm trying to do is click a specific element on a website which will run a javascript command. I'm not sure whether I should use a Web Browser or HTTP Web Requests. I don't need someone to code it for me, I just need to be pointed in the right direction and hopefully I will figure it out.

Maybe instead of clicking the element, I can run the javascript command?

Just tell me how I can do this and I'll research about it. I'm pretty confused right now.

I'm using the programming language vb.net.

3
  • What are you trying to achieve - programmatically click a Web Page element on a page without user interaction? Also, is this from a Windows Form application? Commented Jun 11, 2013 at 20:10
  • Yes for both questions. How would I achieve this? And can I just use run a javascript command instead of having to click a button? I just need to be pointed in the right direction on what I should use and how I should do it. Commented Jun 11, 2013 at 20:14
  • This is possible, please see my answer below. Commented Jun 11, 2013 at 20:15

2 Answers 2

1

If you're using WinForm WebBrowser control - take a look at webBrowser.Document.InvokeScript method. It allows to execute JavaScript inside of a document, hosted in WebBroswer control.

Sign up to request clarification or add additional context in comments.

Comments

1

You can call a javascript function on click event.

For ex: on anchor tags, a href="#" onclick="SomeFunction();"

Or you can use jquery to handle click events.

Ref: http://api.jquery.com/click/

Thanks.

1 Comment

I'm using visual basic and I'm trying to programmatically click an element.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.