Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Regarding Alert Interface
Yesterday at 2:00 pm by karthikeyakumar

» Geting issues in identifying the elsements in webdriver
Fri Feb 17, 2017 4:41 pm by janbaskt

» WebDriver - why not to use a singlton for it?
Fri Feb 17, 2017 4:40 pm by janbaskt

» WebDriver session when using testng annotation to invoke driver instance
Fri Feb 17, 2017 4:39 pm by janbaskt

» Selenium fails to launch Chrome
Fri Feb 17, 2017 4:39 pm by janbaskt

» why do i get this error
Fri Feb 17, 2017 4:38 pm by janbaskt

» Selenium Tutorial
Thu Feb 16, 2017 5:21 pm by Rahul

» When to use Selenium IDE, RC and WebDriver
Mon Feb 13, 2017 2:35 pm by azharuddin

» How to integrate selenium with ZAPI-Zephyr
Sat Feb 11, 2017 2:25 am by gseera002c

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

wait for input element to be populated from database value?

View previous topic View next topic Go down

wait for input element to be populated from database value?

Post by stefaca on Wed Feb 05, 2014 9:54 pm

I have a problem with adding pause for some steps. here is a problem: I have input form in which I input some value. in a few next forms data must be located in database and autopopulated. after that auto populated step I can continue with my test. here is what I did but with no success. locate first form which must be populated with database values pt1:r1:1:pt1:it8::content, try to get value. if there is value print (just for my print), if no value auto inputed from database I'm trying to make pause but no pause is apearing


Code:
WebElement we = driver.findElement(By.id("pt1:r1:1:pt1:it8::content"));
        String ime = we.getAttribute("value");
       
        if (ime != null && !ime.isEmpty()) {
            System.out.println("Popunjen podatak! Ime: " + ime);
        } else {
            Boolean pause = false;
            String temp = we.getAttribute("value");
            System.out.println("Ime u ličnim podacima :" + temp);
            pause = (new WebDriverWait(driver, 5)).until(ExpectedConditions.textToBePresentInElement(we, ""));
            if (pause){
                System.out.println("PAUZA!");
            } else {
                throw new Exception("Nisu povučeni podaci iz baze!");
            }
        }

stefaca

Posts : 2
Join date : 2014-02-05

Back to top Go down

Re: wait for input element to be populated from database value?

Post by stefaca on Thu Feb 20, 2014 6:11 pm

solution:

Code:
WebDriverWait wdw = new WebDriverWait(driver, 5);
 ExpectedCondition<Boolean> ec = new ExpectedCondition<Boolean>() {
 
@Override
 public Boolean apply(WebDriver wd) {
 WebElement result = wd.findElement(By.id("pt1:r1:1:pt1:it8::content"));
// da vrati kada se ime dovuce
 return !result.getAttribute("value").isEmpty();
 }
 };
 wdw.until(ec);

stefaca

Posts : 2
Join date : 2014-02-05

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum