title: Selenium-Web Driver Cannot read property 'filter' of undefined
body: <p>I have started using Selenium. When I want to wait for the element to be loaded, it throws this error: </p>
  
  <pre><code>    (node:8472) UnhandledPromiseRejectionWarning: NoSuchElementError: no such element: Unable to locate element: {"method":"xpath","selector":"//a[@value='view all']"}
    (Session info: chrome=70.0.3538.110)
    (Driver info: chromedriver=2.45.615291 (ec3682e3c9061c10f26ea9e5cdcf3c53f3f74387),platform=Windows NT 10.0.17134 x86_64)
      at Object.checkLegacyResponse (C:\Users\Ben Levy\Desktop\bot\node_modules\selenium-webdriver\lib\error.js:585:15)
      at parseHttpResponse (C:\Users\Ben Levy\Desktop\bot\node_modules\selenium-webdriver\lib\http.js:533:13)
      at Executor.execute (C:\Users\Ben Levy\Desktop\bot\node_modules\selenium-webdriver\lib\http.js:468:26)
      at process._tickCallback (internal/process/next_tick.js:68:7)
  (node:8472) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
  (node:8472) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  </code></pre>
  
  <p>Here is the code I am trying:</p>
  
  <pre><code>const {Builder, By, Key, until} = require('selenium-webdriver'),
    app = require('express'),
    express = app();
  
  let driver = new Builder().forBrowser('chrome').build();
  
  driver.get('https://supremenewyork.com');
  
  driver.findElement(By.className('shop_link')).click();
  
  driver.wait(()=&gt;{
    driver.findElement(By.xpath("//a[@value='view all']").isDisplayed());
  });
  //Bugged code starts below.
  let all = driver.findElement(By.xpath("//a[@value='view all']"));
  
  driver.promise.filter(all, (element)=&gt;{
    return element.isDisplayed();
  }).then((element)=&gt;{
    element.click();
  });
  //End of bugged code.
  </code></pre>
  
  <p>Please tell me what I am doing wrong/a better method for waiting until the element is loaded. Thanks!</p>
  
  <hr>
  
  <p>This is the revised code:</p>
  
  <pre><code>const {Builder, By, Key, until} = require('selenium-webdriver'),
    app = require('express'),
    express = app();
    driver = new Builder().forBrowser('chrome').build();
  
  driver.get('https://supremenewyork.com');
  
  driver.findElement(By.className('shop_link')).click();
  async function main(){
    let all = await driver.findElements(By.xpath("//a[@value='view all']")),
    element,
    visible;
  
    for(element of elements){
      visible = await element.isDisplayed();
      if (visible) {
      element.click();
      }
    }
  };
  </code></pre>