mardi 18 avril 2017

Cannot make a static reference to the non-static method until(Function) from the type Wait

I get an error saying 'Cannot make a static reference to the non-static method until(Function) from the type Wait' when I use the wait method for the visibility of the date.

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
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.Wait;
import org.openqa.selenium.support.ui.WebDriverWait;

public class ch1 {

    static WebDriver driver;
    
    public static void main(String[] args) throws InterruptedException {
        System.setProperty("webdriver.chrome.driver", "C://testing/chromedriver_win32/chromedriver.exe");
        driver = new ChromeDriver();
        try{
                 driver.get("https://www.via.com");
          driver.findElement(By.xpath("//*[@id='wzrk-cancel']")).click();

        }
     
   finally{
                
            driver.manage().timeouts().implicitlyWait(5000, TimeUnit.MILLISECONDS);
           
            driver.findElement(By.xpath("//input[@class='ui-autocomplete-input']")).sendKeys("BLR");
            driver.findElement(By.xpath("//*[@id='round-trip-panel']/div[3]/div/div")).click();
           WebElement date = driver.findElement(By.xpath("//*[@id='depart-cal']/div[3]/div[2]/div[5]/div[text()='19']"));
           Wait.until(ExpectedConditions.visibilityOf(date));
                date.click();
          
        }
 
    }

}

Aucun commentaire:

Enregistrer un commentaire