static void Main()
{
IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl("http://google.com");
IWebElement body = driver.FindElement(By.TagName("body"));
body.SendKeys(Keys.Control + "t");
}
This is the code that I am trying to use to open a new tab, and it doesn’t work, I don’t get anything, the driver opens Google, and all this .... I searched a lot and found a lot of tutorials, even videos where people use the same the code, and it works for them, but for me it is not, and I cannot figure it out ...
I tried to send Keys.Shift + "t" to the search field and it works, it writes capital T to the field
I also tried
Actions act = new Actions(driver);
act.KeyDown(Keys.Control).SendKeys("t").Perform();
And it still doesn't work, but then again, if I change Keys.Control to Keys.Shift, he writes, it seems that nothing related to Keys.Control works !!
Edit: I tried to run the code using the IE driver, and it worked there, it opens a new tab, but it does not open new tabs in Chrome?