My goal was to utilize Selenium Webdriver to click a button on a web page. I was able to successfully achieve this using Chrome Developer Tools, however, I encountered a "can't find variable" error when executing Javascript code:
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
js.ExecuteScript("$('.XbuttonName').click();");
I suspected that this error could be related to permissions, especially since I was able to click the button using WebDriver in the following way:
var button = driver.FindElement(By.ClassName("XclassName"));
button.Click();
Are there any alternate methods for executing scripts with Selenium Driver?