Gecko Browser点击Facebook上的Like按钮

时间:2016-07-31 09:55:20

标签: c# facebook geckofx

我试图像按钮一样点击facebok页面,但我无法让gecko找到属性的id。

* Geckofx工作正常。

这是我的Form1.Load:

DECLARE @sql nvarchar(MAX) = 'SELECT Id, Name, AttachId'

SELECT @sql = @sql 
  + ', MAX(IIF(ValueNum = ' + LTRIM(STR(ColumnNum)) + ', ColorId, NULL)) AS ColorId' + LTRIM(STR(ColumnNum))
FROM (
  SELECT DISTINCT 
    DENSE_RANK() OVER (ORDER BY ColorId) AS ColumnNum
  FROM dbo.DeviceView
  WHERE Id IN (
    SELECT TOP 1 Id 
    FROM dbo.DeviceView 
    GROUP BY Id 
    ORDER BY COUNT(DISTINCT ColorId) DESC)
) AS c

EXEC (@sql 
  + ', [Date] FROM ('
  + 'SELECT Id, Name, AttachId, ColorId, [Date], DENSE_RANK() OVER (PARTITION BY Id ORDER BY ColorId) AS ValueNum FROM dbo.DeviceView'
  + ') AS it '
  + 'GROUP BY Id, Name, AttachId, [Date]');

这是documentCompleted方法:

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

我该怎么办?

1 个答案:

答案 0 :(得分:0)

我发现Click()并不总是适用于某些网站。不知道为什么。另一种方法是关注元素然后使用sendkeys函数和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