First lets create a simple ASP.NET Web application that uses DevExpress controls. I have created a test.aspx page that has got 2 buttons
Code behind (test.aspx.cs)
Now here is the snippet of code that can be used to simulate button click
Nearly all men can stand adversity, but if you want to test a man's character, give him power. Abraham Lincoln
Code behind (test.aspx.cs)
protected void TestMe_Click(object sender, EventArgs e)
{
Response.Redirect("success.aspx");
}
protected void TestMe2_Click(object sender, EventArgs e)
{
Response.Redirect("Fail.aspx");
}
Now here is the snippet of code that can be used to simulate button click
WebDriver driver = new InternetExplorerDriver(@"C:\selenium\selenium-dotnet-2.33.0\IEDriverServer_x64_2.33.0");
driver.Navigate().GoToUrl("http://localhost/test/Test.aspx");
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
var result = js.ExecuteScript("TestMe.click();");
//or
IWebElement btn = driver.FindElement(By.Id("TestMe"));
btn.Click();
Use this Quick Start guide to setup your machine for testing ASP.NET Web applications. For more detailed or complete understanding goto Selenium WebDriver
Nearly all men can stand adversity, but if you want to test a man's character, give him power. Abraham Lincoln




