I aimed to use Selenium Webdriver to click a button in a web page. I did it successfully on Chrome Developer Tools but I got "can't find variable" error while I was execute Javascript code:
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
js.ExecuteScript("$('.XbuttonName').click();");
I thought it is related with permissions because I also click the button in a healthy way with WebDriver as follows:
var button = driver.FindElement(By.ClassName("XclassName"));
button.Click();
Are there any different options to execute scripts with Selenium Driver?