Answer the question
In order to leave comments, you need to log in
How to send key combination C# Selenium Webdriver?
How to send key combination C# Selenium Webdriver?
Maybe you didn't connect the addon. libraries, only OpenQA.Selenium is connected.
I want to close the active browser tab, the window.close() request does not respond to JS, I want to try sending the CTRL + W combination
. Thank you all in advance.
Answer the question
In order to leave comments, you need to log in
To close a window, you need to find out its Handle, then switch to it using SwitchTo (), and then do driver.Close () - this method will close the current open window, if it is the last one, an empty one will be opened in place of the closed one.
IWebDriver driver = new FirefoxDriver();
Actions action=new Actions(driver);
action.SendKeys(OpenQA.Selenium.Keys.Control + "w").Build().Perform();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question