vendredi 28 juillet 2017

Else if statement with Selenium doesen't work

I have to test a website with Selenium in C# On the Site, there are buttons(10) in a random order. The program should check if the Button is available or not. Below I created an else if statemeent, but it didn't work. (The program doesn't click anything.

if (driver.FindElement(By.Name("btnK")).Displayed)
   {
      driver.FindElement(By.Name("btnK")).Click();
   }
else if (driver.FindElement(By.Name("btnG")).Displayed)
   {

      driver.FindElement(By.Name("btnG")).Click();
   }

Can anyone support me in this case?

Kind regards

Aucun commentaire:

Enregistrer un commentaire