mardi 16 novembre 2021

Sends Keys in Selenium and getting rid of the Switch

I am sending Keys in the following manner:

    switch (keyName)
    {
         case "Return":
            new Actions(WebDriver).SendKeys(Keys.Return).Perform();                  
            break;
         case "F4":
            new Actions(WebDriver).SendKeys(Keys.F4).Perform();
            break;
         defult:
            "TBD"
     }
     

I would like to get rid of the Switch/Case statement using something like MethodInfo or FieldInfo, But I can't seem to find the right way to do it.

Hopefully you can help...

Thanks





Aucun commentaire:

Enregistrer un commentaire