I am creating a script for saving a record. There is a save button and it has an ID and javascript in it. Below is my script:
[FindsBy(How = How.Id, Using = "ctl00_MainContent_btnSave")]
IWebElement btnSavePCOption1 { get; set; }
public void SaveRequest()
{
btnSavePCOption1.Click();
}
I called this method and the save button won't work. I replaced it with javascript executor:
IJavaScriptExecutor js = DriverContext.Driver as IJavaScriptExecutor;
js.ExecuteScript("return btnSave.OnClientClick(this, event);");
This line worked. Since I am the only QA in the team and my team has not experienced automation, I consulted my software architect to see if this is valid and he rejected the idea of using a javascript executor because my script is supposed to be mimicking the user's actions. How valid is using a javascript executor on a script if that is the case?