Click here to Skip to main content
15,885,829 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
improved question:
actually i am developing a vb.net desktop application, in which i am trying to add a browser and will be navigated to my company's website.
on that i want the application to automatically click a button with a star shape.
as i am not so familiar with html so didnt understand the code of the website which i got by seeing the page source.
but got the code for the button which is shown below.
i understand that the html element must have an id, but there is no id for the html element given for this button.
so i am not able to click button with the code.

XML
<button class="like-btn" type="submit">
<i class="icon-star"></i>
</button>
Posted
Updated 13-Oct-14 21:59pm
v2

Hi,

Once the brower windowe is active try sending Enter key stoke using the below code.
System.Windows.Forms.SendKeys.Send("{ENTER}");


Thanks
 
Share this answer
 
Comments
Kashif Alvi 14-Oct-14 14:39pm    
The enter key is not working here.
i want to click that button which does not have any element id
Hi if there is something unique about the button, like it class is just for this one button or its tag, you can search your source using RegEx or if its repeated and not unique like :

HTML
<button class="like-btn" type="submit">

</button>
<button class="like-btn" type="submit">
^__i class="icon-star">
</button>


and you want the firs, last or a unique one of them you can use HtmlElement & HtmlElementCollection and use index of your HtmlElementCollection variable to find it.

Check out HtmlElement Class[^] for more info.

sorry for my English.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900