kevinabrandon / AboveTustin

ADS-B Twitter Bot. Uses dump1090-mutability to track airplanes and then tweets whenever an airplane flies overhead.
MIT License
72 stars 21 forks source link

Screenshot can fail when there are lots of aircraft #25

Open wiseman opened 6 years ago

wiseman commented 6 years ago

It looks like screenshot.clickOnAirplane can fail if there are so many aircraft in the list that the one it's trying to click on has scrolled below the visible portion of the window. The error is

selenium.common.exceptions.ElementNotVisibleException: Message: {"errorMessage":"Element is not currently visible and may not be manipulated", ...}

This stackoverflow post has an idea for a workaround, which is to run javascript in the headless browser that causes the click to occur whether the element is visible or not:

JavascriptExecutor jsx = (JavascriptExecutor)driver;
jsx.executeScript("arguments[0].click();", element);