Biology, asked by anki3471, 1 year ago

Efficient induction of apoptosis in cancer cells by paclitaxel-loaded selenium nanoparticles

Answers

Answered by zoya5832
0

Answer:

To understand this chapter you have to learn the concepts discussed in the earlier WebDriver Waits chapter already. Also it is better to learn How to Handle Ajax Wait in Selenium.

In this chapter we will explore more on the Fluent Waits and see how we can create our own Custom Waits or Advance WebDriver Waits. A fluent wait looks like this:

//Declare and initialise a fluent wait

FluentWait wait = new FluentWait(driver);

//Specify the timout of the wait

wait.withTimeout(5000, TimeUnit.MILLISECONDS);

//Sepcify polling time

wait.pollingEvery(250, TimeUnit.MILLISECONDS);

//Specify what exceptions to ignore

wait.ignoring(NoSuchElementException.class)

//This is how we specify the condition to wait on.

//This is what we will explore more in this chapter

wait.until(ExpectedConditions.alertIsPresent());

1

2

3

4

5

6

7

8

9

10

11

12

//Declare and initialise a fluent wait

FluentWait wait = new FluentWait(driver);

//Specify the timout of the wait

wait.withTimeout(5000, TimeUnit.MILLISECONDS);

//Sepcify polling time

wait.pollingEvery(250, TimeUnit.MILLISECONDS);

//Specify what exceptions to ignore

wait.ignoring(NoSuchElementException.class)

//This is how we specify the condition to wait on.

//This is what we will explore more in this chapter

wait.until(ExpectedConditions.alertIsPresent());

Fluent waits are also called smart waits also. They are called smart primarily because they don’t wait for the max time out, specified in the .withTimeout(5000, TimeUnit.MILLISECONDS). Instead it waits for the time till the condition specified in .until(YourCondition) method becomes true.

A flow diagram explaining the working of Fluent wait is explained in the below diagram.

mplicitWait

When the until method is called, following things happen in strictly this sequence

Step 1: In this step fluent wait captures the wait start time.

Step 2: Fluent wait checks the condition that is mentioned in the .until() method

Step 3: If the condition is not met, a thread sleep is applied with time out of the value mentioned in the .pollingEvery(250, TimeUnit.MILLISECONDS) method call. In the example above it is of 250 milliseconds.

Step 4: Once the thread sleep of step 3 expires, a check of start time is made with the current time. If the difference between wait start time, as captured in step 1, and the current time is less than time specified in .withTimeout(5000, TimeUnit.MILLISECONDS) then step 2 is repeated.

Similar questions