How to access elements when you get ElementNotInteractableException

My answer to this question on Quora:

How do I resolve the ElementNotInteractableException in Selenium WebDriver?

ElementNotInteractableException is caused when an element is found, but you can not interact with it. For instance, you may not be able to click or send keys.

There could be several reasons for this:

  1. The element is not visible / not displayed
  2. The element is off screen
  3. The element is behind another element
  4. Some other action needs performed (by the user) to enable it.

Strategies that may work to make it interactable (depending on the circumstance.)

  1. Wait until an element is visible / clickable
    WebDriverWait wait = new WebDriverWait(driver, timeout);
    wait.until(ExpectedConditions.visibilityOf(element));
    wait.until(ExpectedConditions.elementToBeClickable(element));
  2. Scroll until the element is within view
    Actions action = new Actions(driver);
    action.moveToElement(element);
  3. Use javascript to interact directly with the DOM
    JavascriptExecutor js = (JavascriptExecutor) driver;
    js.executeScript("document.querySelector('locator');
                      element.value = 'whatever';")
  4. Perform whatever other action is necessary and possibly wait until after that.

Viewing or converting .flv video to .mp4

ffmpeg is a command line tool that can convert .flv videos to .mp4 (or another format).

ffmpeg -i video.flv -codec copy video.mp4

Ffmpeg is easy to script, but the number of command line options can be daunting.

Screen Shot 2018-01-09 at 4.42.52 PM.png

handbrake is a GUI application that can also convert .flv to .mp4.

Handbrake is actually a wrapper around ffmpeg that offers sensible defaults but still allows you access to many options.

Screen Shot 2018-01-09 at 4.38.41 PM.pngVLC is an app that can view .flv videos directly.  The VLC Player is free to use.

Screen Shot 2018-01-09 at 4.42.41 PM.png