Search code examples
c#seleniuminternet-explorerselenium-webdriverbrowserstack

Which is the correct way to send @ to input in selenium?


I am using

email.SendKeys("[email protected]")

but sometimes is putting myemail2gmail.com, is putting 2 instead of @, I already did a quick research and I would like to know if this is the best solution

email.SendKeys("myemail" + Keys.Shift + "2" + Keys.Shift + "gmail.com");

The issue is in IE 11 and I am using browserstack with specflow in Visual Studio c#.


Solution

  • I used something similar than @Agent Shoulder said

    var _element= driver.FindElement(By.Id("id"));
    IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
    js.ExecuteScript("arguments[0].setAttribute('value', '[email protected]')", _element);