连续更新网站上具有刮擦价值的文本



我得到了我的程序来从phantomjs登录后从网页上刮擦一个值,但值(余额)每隔一分钟更新。

随着网页更新值,我需要做些什么才能在我的Windows表单中连续更新标签(每五分钟)。所以我需要一个循环吗?

System.Threading.Thread.Sleep(2000);
var points = driver.FindElement(By.CssSelector(
  "#site-header > div > div > div.col-xs-8.col-sm-8.col-md-8 > div > " +
  "div.header-right.header-user-functions > div:nth-child(5) > a > span"));
if (points != null)
{
    bunifuCustomLabel7.Text = points.Text;
}
System.Threading.Thread.Sleep(2000);

我认为您可能正在寻找计时器:

var timer = new System.Windows.Forms.Timer((x) =>
{
    MethodToUpdateForm();   
}, null, 0, (int)TimeSpan.FromMinutes(5).TotalMilliseconds);

最新更新