1
所以我有一個問題,如何更新硒線程的UI線程上的標籤。正如你看到硒線程調用使用其他類的靜態方法(Login.UserLogin,Run.StartDriver)的「selenium」方法。如何更新硒線程/類內的UI線程/類的標籤
我似乎無法弄清楚如何從登錄或運行類更改此類中的標籤。對不起,如果編碼是業餘的,我剛開始學習C#。
public class Form1{
private void startThread()
{
if (seleniumThread == null)
{
stopThread = false;
seleniumThread = new Thread(() => selenium(userName, passWord,
cyclesWanted));
seleniumThread.Start();
}
}
private void selenium(string user, string pass, int cycles)
{
driver = new FirefoxDriver();
Login.UserLogin(driver, user, pass);
Run.StartDriver(driver, cycles);
if (stopThread)
{
driver.Quit();
return;
}
}
private void button1_Click(object sender, EventArgs e)
{
startThread();
}
}