私はプログラミングが初めてです。VisualStudio C# でウィンドウ フォームを使用しています。私の問題は、ウィンドウ フォームの最初のボタンをクリックした後、ブラウザを開き、ログインしたい URL に移動し、その後、ウィンドウ フォームの 2 番目のボタンをクリックすると、コードの 2 番目のブロックが実行されないことです。 . エラーメッセージは表示されません。全くの初心者なのでどなたか教えてください。よろしくお願いします!
public partial class Form1 : Form
{
IWebDriver driver = null;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
driver = new FirefoxDriver();
driver.Url = "https://accounts.google.com/ServiceLogin";
driver.Manage().Window.Maximize();
}
private void button2_Click(object sender, EventArgs e)
{
driver.Url = "https://accounts.google.com/ServiceLogin";
var email = driver.FindElement(By.Id("Email"));
email.SendKeys("-------------");
var password = driver.FindElement(By.Id("Passwd"));
password.SendKeys("---------");
password.FindElement(By.Id("signIn"));