0

I am current trying to set up a test case using Readyapi, this automated test case has to find the website and login which is all fine. My problem is that when if logs in it also has to check if the log out button appears, that's when I'm getting the error.

Code:

    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.ExpectedCondition 
    import org.openqa.selenium.support.ui.WebDriverWait
    import org.openqa.selenium.WebDriverException;
    import org.openqa.selenium.chrome.ChromeOptions;

    import org.openqa.selenium.Alert;
    import org.openqa.selenium.JavascriptExecutor;
    import org.openqa.selenium.NoAlertPresentException;
    import org.openqa.selenium.NoSuchElementException;
    import org.openqa.selenium.NoSuchFrameException;
    import org.openqa.selenium.StaleElementReferenceException;

    // Creating Chrome driver object.
    System.setProperty("webdriver.chrome.driver","C:\\Training\\chromedriver.exe");
    WebDriver driver = new ChromeDriver();
    driver.manage().window().maximize()

    def  aUser = context.expand( '${#Project#username}' )
    def  aPass = context.expand( '${#Project#authPass}' )
    def  wUrl = context.expand( '${#Project#webUrl}' )

    String URL = "https://"+aUser+":"+aPass+"@"+wUrl;
    driver.get(URL);

    //*[@id="welcome"]/nav/div/div/ul[2]/li[2]/a
    driver.findElement(By.xpath("//*[@id='welcome']/nav/div/div/ul[2]/li[2]/a")).click();

    def email = context.expand( '${#Project#email}' )
    def pass = context.expand( '${#Project#password}' )

    //*[@id="inputEmail"]
    driver.findElement(By.xpath("//*[@id='inputEmail']")).sendKeys(email);
    //*[@id="inputPassword3"]
    driver.findElement(By.xpath("//*[@id='inputPassword3']")).sendKeys(pass);
    //*[@id="j_id0:idpPost1"]/div/div[3]/input
    driver.findElement(By.xpath("//*[@id='j_id0:idpPost1']/div/div[3]/input")).click();

    WebDriverWait wait = new WebDriverWait(driver, 2000);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='logout-link']/span[2]")));

        driver.close();

Error: groovy.lang.missing propertyexception no such property: Error expectedconditions for class: Script25

Note: The script number in the error seems to change each time I change something.

Any help would be greatly appreciated!

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • 1
    do you need to `import org.openqa.selenium.support.ui.ExpectedConditions'? – bdkosher Jul 03 '18 at 18:05
  • @bdkosher Thank you man, I'm an idiot. I had "import org.openqa.selenium.support.ui.ExpectedCondition" in my code, I was missing the 's' at the end. thanks again – peter larkin Jul 04 '18 at 09:53

0 Answers0