I want to perform different operations based on nation name with Selenium. However, I think I'm making a mistake in the condition that the codes are not working. How can I meet this condition?
if (nationality.Trim()==("T.C.")) { var nationality = drv.FindElement(By.XPath("/html/body/form[2]/div[4]/div/div[3]/div/div/div[1]/div/div[4]/div/div[2]/div/div/div/div[1]/div/div/div[2]/h4")).Text; if (nationality.Trim()==("T.C.")) { var val4 = drv.FindElement(By.XPath("/html/body/form[2]/div[4]/div/div[3]/div/div/div[1]/div/div[4]/div/div[2]/div/div/div/div[2]/div/div/div[1]")).Text; Thread.Sleep(3000); var val5 = drv.FindElement(By.XPath("/html/body/form[2]/div[4]/div/div[3]/div/div/div[1]/div/div[4]/div/div[2]/div/div/div/div[3]/div/div/div[1]")).Text; Thread.Sleep(3000); var val6 = drv.FindElement(By.XPath("/html/body/form[2]/div[4]/div/div[3]/div/div/div[1]/div/div[4]/div/div[2]/div/div/div/div[9]/div/div/div/input")).GetAttribute("value"); Thread.Sleep(3000); var val7 = drv.FindElement(By.XPath("/html/body/form[2]/div[4]/div/div[3]/div/div/div[1]/div/div[2]/div/div[2]/div/div/h4")).Text; } else { var val4 = drv.FindElement(By.XPath($"/html/body/form[2]/div[4]/div/div[3]/div/div/div[1]/div/div[4]/div/div[2]/div/div/div/div[2]/div/div/div[1]")).Text; Thread.Sleep(3000); var val5 = drv.FindElement(By.XPath($"/html/body/form[2]/div[4]/div/div[3]/div/div/div[1]/div/div[4]/div/div[2]/div/div/div/div[3]/div/div/div[1]")).Text; Thread.Sleep(3000); var val6 = drv.FindElement(By.XPath($"/html/body/form[2]/div[4]/div/div[3]/div/div/div[1]/div/div[4]/div/div[2]/div/div/div/div[9]/div/div/div/input")).GetAttribute("value"); var val7 = drv.FindElement(By.XPath($"//html/body/form[2]/div[4]/div/div[3]/div/div/div[1]/div/div[2]/div/div[2]/div/div/input")).GetAttribute("value");