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 had same issue and observation was , multiple elements by same xpath. Finding different unique xpath resolved it
The problem is, that you've found an element that is not graphically displayed in the web browser - location property has value: X=0 and Y=0; so you've probably located a wrong element.
This error message...
Javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite
...implies that the WebDriver instance was unable to find the desired element using the Locator Strategy for one or the other reasons:
<iframe>
/ <frame>
display: none;
The relevant HTML would have been helpful to analyze the issue in a better way. However, you need to take care of a couple of things as follows:
Ensure that the locator strategy identifies the desired element uniquely within the HTML DOM.
Induce WebDriverWait for the elementToBeClickable()
and you can use either of the following Locator Strategies:
cssSelector
:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("elementCssSelector"))).click();
xpath
:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("elementXpath"))).click();
If the WebElement is within an <iframe>
/ <frame>
you need to induce WebDriverWait for the desired frameToBeAvailableAndSwitchToIt()
.
You can find a relevant detailed discussion in Is it possible to switch to an element in a frame without using driver.switchTo().frame(“frameName”) in Selenium Webdriver Java?
You can find a couple of relevant detailed discussions in:
I have also faced the same issue. In my case the problem was that the element I tried to move to wasn't visible yet in the browser.
So I used time.sleep(1)
After that it worked.
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<IWebDriver, bool> 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;
}
};
}
I have faced the same issue and was able to resolve it by simply scrolling the window down to the element I am targeting. Seems like the element wasn't showing in the viewport and that's why it wasn't visible to selenium.
Try to add the following lines before finding and clicking the element:
driver.execute_script("window.scrollTo(0, window.scrollY + 100)")
driver.implicitly_wait(3)