简体   繁体   中英

How to validate Extract Autopopulate value from text field using webdriver?

I have Zipcode input box , once I entered Zipcode , the state and city input boxes are auto populating with the relevant data. how to capture and validate those State and city input box value enter image description heres using Selenium enter image description here Webdriver ?

Only thing here is you need to use getText() to retrieve text from any specified location and can verify by assertions. Lets say id of state field is 'state', then

 String populatedState=driver.findElement(By.id("state")).getText();

 Assert.assertEquals(populatedState, "expected state here");

Thank You, Murali

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM