-1

I am trying to click facebook page like button, but i can't make gecko find the id of attribute.

*Geckofx is working properly.

Here is my Form1.Load:

geckoWebBrowser1.Navigate("https://www.facebook.com/AmaciOlmayanGrup/?fref=ts");

And here is documentCompleted Method:

        GeckoButtonElement button = new GeckoButtonElement(geckoWebBrowser1.Document.GetHtmlElementById("u_jsonp_7_d").DomObject);
        button.Click();

What should i do?

lepe
  • 24,677
  • 9
  • 99
  • 108
Ali
  • 69
  • 1
  • 1
  • 12
  • 1
    why would you do that anyway? why not just hit the like button with your mouse? likes should always be "real", autoliking and scraping is not allowed on facebook. – andyrandy Jul 31 '16 at 10:06

1 Answers1

0

Ive found Click() doesnt always work on some websites. Not sure why. Another way is to get focus on the element then use sendkeys function with ENTER.

https://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelement.focus(v=vs.110).aspx

https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys(v=vs.100).aspx.

ageorge753
  • 31
  • 5