You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Function IsOverlapped(ByRef objWebDriver As SeleniumVBA.WebDriver, ByRef objWebElt As SeleniumVBA.WebElement) As Boolean
Dim _
objWebEltCheck As SeleniumVBA.WebElement
Set objWebEltCheck = getOverlappingWebElt(objWebDriver, objWebElt)
IsOverlapped = (objWebElt.GetElementId() <> objWebEltCheck.GetElementId())
Set objWebEltCheck = Nothing
End Function
Function getOverlappingWebElt(ByRef objWebDriver As SeleniumVBA.WebDriver, ByRef objWebElt As SeleniumVBA.WebElement) As SeleniumVBA.WebElement
Dim _
objWebEltCheck As SeleniumVBA.WebElement, _
dictRect As Dictionary
Set dictRect = objWebElt.GetRect()
Set getOverlappingWebElt = objWebDriver.ExecuteScript("return document.elementFromPoint(arguments[0], arguments[1]);", Int(dictRect("x") + dictRect("width") / 2), Int(dictRect("y") + dictRect("height") / 2))
Set dictRect = Nothing
End Function
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Somtimes you may have trouble clicking overlapped elements. I did a port form a simple Python solution (https://stackoverflow.com/questions/49921128/selenium-cant-click-element-because-other-element-obscures-it/72361846#72361846).
Probably it is of interest to some.
Beta Was this translation helpful? Give feedback.
All reactions