Explicit Wait and Fluent Wait error in Selenium Webdriver

0 votes

I wrote a code using Selenium in which I created a method that will explicitly wait for elements to appear
but its working as I expected. Below is the cose:

public String explicitWait(String new1) {

    WebDriverWait wait = new WebDriverWait(driver,30);
    WebElement element = wait.until(
                        ExpectedConditions.elementToBeClickable(By.id(new1)));
    return new1;
}

Then I call the method and pass it a parameter like this:

explicitWait("new-message-button");

But its not working, please help in this

Apr 2, 2018 in Selenium by Shubham
• 12,150 points
459 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You should use Explicit wait or Fluent Wait for this matter. Below is the example which will help you

WebDriverWait wait = new WebDriverWait(WebDriverRefrence,20);
WebElement web1;
web_1= wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("web_1")));

Example of Fluent Wait -

Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)                           
.withTimeout(20, TimeUnit.SECONDS)         
.pollingEvery(5, TimeUnit.SECONDS)         
.ignoring(NoSuchElementException.class);    

  WebElement web1= wait.until(new Function<WebDriver, WebElement>() {      
public WebElement apply(WebDriver driver) {
return driver.findElement(By.id("web_1"));    

});

answered Apr 2, 2018 by ghost
• 1,790 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,030 points
3,487 views
0 votes
1 answer

How do i change the location where my file gets downloaded in Selenium Webdriver and firefox driver?

There are a couple of errors there. ...READ MORE

answered Apr 12, 2018 in Selenium by nsv999
• 5,030 points
803 views
0 votes
1 answer

30 min Wait on a page and then perform any Operation using Selenium Webdriver

Implicit wait tells webdriver to poll the ...READ MORE

answered Apr 19, 2018 in Selenium by Shubham
• 12,150 points
67 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,030 points
60 views
0 votes
1 answer

Impilicit wait vs Explicit wait vs Fluent wait

Implicit wait: Your telling the WebDriver the ...READ MORE

answered Apr 13, 2018 in Selenium by king_kenny
• 3,590 points
534 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
432 views
0 votes
1 answer

Differences between Implicit wait Vs. Explicit wait in selenium webdriver

Implicit Wait - It instructs the web driver ...READ MORE

answered Apr 9, 2018 in Selenium by ghost
• 1,790 points
982 views
0 votes
1 answer

Handling JavaScript Alert window in Selenium WebDriver

You should try using waits for alerts ...READ MORE

answered Apr 10, 2018 in Selenium by ghost
• 1,790 points
582 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.