title: I can't find a button using id or xpath using pagefactory on expedia.com website
body: <p>I can't find a button using id or xpath using pagefactory on expedia.com website. It says no such element: Unable to locate element "tab-flight-tab-flp".
  I tried using id and xpath. It gives same error. I wonder this is happening?
  It says no such element: Unable to locate element "tab-flight-tab-flp".
  I tried using id and xpath. It gives same error. I wonder this is happening?
  It says no such element: Unable to locate element "tab-flight-tab-flp".
  I tried using id and xpath. It gives same error. I wonder this is happening?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>package UsefulPackages;
  
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.support.FindBy;
  import org.openqa.selenium.support.PageFactory;
  
  public class SearchPageFactory {      
  
         WebDriver adriver;     
  
         @FindBy(id="tab-flight-tab-flp")
         WebElement flightTab;      
        
         //constructor
         public SearchPageFactory(WebDriver driver) {
  
               this.adriver = driver;
               PageFactory.initElements(driver, this);
         }     
  
         public void clickFlightTab(){            
  
               flightTab.click();          
  
         }     
  
  }
  
   </code></pre>
  </div>
  </div>
  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>import java.util.Set;
  import java.util.concurrent.TimeUnit;
  import org.openqa.selenium.Alert;
  import org.openqa.selenium.By;
  import org.openqa.selenium.Keys;
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.WebElement;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.openqa.selenium.support.ui.ExpectedConditions;
  import org.openqa.selenium.support.ui.WebDriverWait;
  import org.junit.After;
  import org.junit.AfterClass;
  import org.junit.Before;
  import org.junit.BeforeClass;
  import org.junit.Test;
  import UsefulPackages.SearchPageFactory;
  
  public class FrameworkTestCase {
  
         WebDriver achromeDriver;
         String abaseUrl;
  
        SearchPageFactory apagefactory;            
  
         @Before
         public void setUp() throws Exception {                            
  
               abaseUrl = "http://www.expedia.com";                           
  
              System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\ChromeDirver\\chromedriver.exe");                           
  
              achromeDriver = new ChromeDriver();                           
  
              apagefactory = new SearchPageFactory(achromeDriver);                           
  
              chromeDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
              achromeDriver.manage().window().maximize();
              System.out.println("setup completed");
  
         }            
  
        @Test
  
           public void test() {                            
  
                 achromeDriver.get(abaseUrl);                                                         
  
                 WebDriverWait awaittime = new WebDriverWait(achromeDriver, 10);      
  
                 System.out.println("page factory created");                           
  
                  apagefactory.clickFlightTab();
                }
  
   
  
   
  
  }
  
   </code></pre>
  </div>
  </div>
  </p>