Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
stefaca
Posts : 2
Join date : 2014-02-05

wait for input element to be populated from database value? Empty wait for input element to be populated from database value?

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!");
            }
        }
avatar
stefaca
Posts : 2
Join date : 2014-02-05

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

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);
Back to top
Permissions in this forum:
You cannot reply to topics in this forum