I am trying to create a automation framework with nunit + Selenium + c#
Our webadmin is based on Devexpress framework hence I can't click button by it's "ID" or atleast I dont know how to. The subtitute to this is simply pressing "Enter" button. I have already tried
driver.FindElement(By.XPath("String")).SendKeys(Keys.Enter);
We can type Enter/Return key in Selenium. We shall use the sendKeys method and pass Keys. ENTER as an argument to the method. Also, we can use pass Keys.
To specify ENTER button functionality in Selenium webdriver we have to use the method sendKeys. To simulate pressing the ENTER button,we have to add the statement import org. openqa. selenium.
webElement. sendKeys(Keys. TAB); //This will enter the string which you want to pass and will press "Tab" button .
using OpenQA.Selenium.Interactions;
Actions builder = new Actions(driver);
builder.SendKeys(Keys.Enter);
For more information: Typing Enter/Return key in Selenium
Use below code to click on an invisible button.
IWebElement tmpElement = Driver.FindElement(By.Id("invisibleButton"));
var executor = (IJavaScriptExecutor)Driver;
executor.ExecuteScript("arguments[0].click();", tmpElement);
wait.Until(d => { return d.Title.Equals("pageTitle"); });
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