Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Selenium WebDriver Integration
Yesterday at 1:06 pm by azharuddin

» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

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