I have a situation where I have to press on the 'ESC' key to stop the page from loading..
This is definitely needed as otherwise the page will keep on loading for a minute.
How do I make selenium webdriver to press the 'Esc' key. This has to be done using C#.
Also, kindly mention the class that has to be imported
Copy & Paste Text: When we need to copy some text from one text box to another, we select the text by pressing "CTRL+A" they copy the text using "CTRL+C" and paste the text in the new text box by simply clicking in the text box and pressing keys "CTRL+V".
Press SHIFT - using keyDown. Press Ctrl - using keyDown. Press then release S (this key can be pressed and immediately released using sendKeys method)
You can send keys directly to the browser using Actions class. See last two lines of the following code:
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Interactions;
IWebDriver driver = new FirefoxDriver(ffprofile);
driver.Navigate().GoToUrl("http://www.google.com");
driver.FindElement(By.Name("q")).SendKeys("Stack Overflow");
driver.FindElement(By.Name("q")).Submit();
Actions action = new Actions(driver);
action.SendKeys(OpenQA.Selenium.Keys.Escape);
Hope that helps.
Maybe this one will help:
System.Windows.Forms.SendKeys.SendWait("{ESC}");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With