java - Does driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS) used only for element search? -



java - Does driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS) used only for element search? -

i want know utilize of driver.manage().timeouts().implicitlywait(10000, timeunit.seconds);

will used element search or other purpose page load , refresh?

i using in begginning of driver initialization.

but in application want inspect error message after entering wrong password,but come in wrong password,it leave page , wont wait error message on same page.will initialize/load page once,when utilize thread.sleep(3) stops @ page 3 secs , reading error message.

but dont want utilize thread.sleep,since using driver.manage().timeouts().implicitlywait(0, timeunit.seconds)

can please tell me utilize , how resolve error?

code snippet:(not working,returning failure) (without thread.sleep)

settext(webelements.text_box, password); click(webelements.submit_button); //thread.sleep(3000); if (iselementpresent(webelements.error_message)) { homecoming success; } else homecoming failure;

the main difference between implicit , explicit waits implicit wait polls dom defined amount of time(let's 10s) , looks element whereas explicit wait periodically sends request server , check element in dom.

the implicit wait firm , fixed driver instance. so, 1 time set time set entire driver instance , applied everywhere. in place, when utilize command find element polls dom defined amount of time without talking server/sending request periodically , throws exception if nil found.

on other hand, explicit wait has default time of 500ms sleeps in unless explicitly overwrite that. meaning acts thread.sleep(); in between intervals , sleeps 500ms , after sends request server , periodically checks element , conditions defined polling interval defined , reaches timeout.

so, in case thread.sleep() working explicit wait. proper resolutions of course of study utilize explicit wait , periodically checks element , it's expected condition.

settext(webelements.text_box, password); webdriverwait wait = new webdriverwait(driver,10); try{ wait.until(expectedconditions.visibilityofelementlocated(by.id("id of element located"))); homecoming success; } grab (nosuchelementexception exception) { homecoming failure; }

java unit-testing selenium testng load-testing

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -