Currently, I am in the process of automating form filling. After filling out the form, there is an update button that changes color instead of clicking when activated. This alteration indicates that the xpath is correctly identified.
I have attempted two different methods to trigger the click event - using JavaScript scrollIntoView and click functions, as well as utilizing the Actions perform code. Both approaches successfully change the button's color, but they do not actually execute the click action. I have applied the following code snippets:
IJavaScriptExecutor executor = (IJavaScriptExecutor)driver;
executor.ExecuteScript("arguments[0].scrollIntoView(true);",element);
executor.ExecuteScript("arguments[0].click();", element);
and also tested this:
Actions builder = new Actions(driver);
builder.MoveToElement(_regRep.btnUpdateOrganization)
.Click()
.Build()
.Perform();
The desired outcome should simply involve clicking the button effectively.