using chrome 78 and chromedriver78 When i click an audio file or try to stop an audio using selenium tests i am getting this error.
Error:
org.openqa.selen
I experienced this same issue while trying to click a cell in an AngularJS grid. I confirmed that my XPath query resulted in only one result, and then explored if adding in a Wait Condition would help. As it turned out, adding in a Wait here allowed the code to continue without error.
The below code is the method I used to click the cell. I switched from Click() to an Action as the Click() method was being intercepted by a different element.
public void ClickEmploymentChangeLogButton()
{
Wait.Until(WaitConditions.ElementIsVisibleAndEnabled(EmploymentChangeLogButton));
Actions actions = new Actions(driver);
actions.MoveToElement(EmploymentChangeLogButton).Perform();
actions.MoveToElement(EmploymentChangeLogButton).Click().Perform();
}
WaitConditions is a separate class to model some of the behaviour of the deprecated ExpectedConditions package.
Here's the method inside WaitConditions that is used above.
public static Func ElementIsVisibleAndEnabled(IWebElement element)
{
return (driver) =>
{
try
{
return element.Displayed && element.Enabled;
}
catch (Exception)
{
// If element is null, stale or if it cannot be located
return false;
}
};
}