EazyTutorials.com

EazyTutorials.com

Share

EazyTutorials.com is a web Developer information website, with much easier tutorials and references relating to web Development/Designing topics.

Gone are the days when you have to scratch your mind into programming languages, Now is the time for some practical learning. We are all set to launch a portal based website on which you can learn and practice at the same time. Now, you don't have to wait to set up your own environment in the computer. Just write the code and see the result on the go. Of course, this will expedite the process of l

20/07/2017

Implicit Wait: (Y)

Selenium WebDriver has borrowed the idea of implicit waits from Watir. This means that we can tell Selenium that we would like it to wait for a certain amount of time before throwing an exception that it cannot find the element on the page. We should note that implicit waits will be in place for the entire time the browser is open. This means that any search for elements on the page could take the time the implicit wait is set for.

Example:

WebDriver driver = new FirefoxDriver();

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

driver.get("url");

WebElement myDynamicElement = driver.findElement(By.id("myDynamicElement"));

WebDriver driver = new FirefoxDriver();

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

driver.get("url");

WebElement myDynamicElement = driver.findElement(By.id("myDynamicElement"));


Explicit Wait: (Y)
It is more extendible in the means that you can set it up to wait for any condition you might like. Usually, you can use some of the prebuilt ExpectedConditions to wait for elements to become clickable, visible, invisible, etc.

Example:

WebDriverWait wait = new WebDriverWait(driver, 10);

WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("someid")));

WebDriverWait wait = new WebDriverWait(driver, 10);
:) (Y)

20/07/2017

Ques: How to make application thread-safe ?

Ans:: You should use the word synchronized to mark the critical section of code. You may also use other methods of thread synchronization (see wait(), notify(), notifyAll() etc.

Want your school to be the top-listed School/college in Pune?

Click here to claim your Sponsored Listing.

Location

Website

https://www.youtube.com/@IntelligenceExchange-fd1ow/videos

Address

Pune