'The connection has timed out Error using Selenium Webdriver

0 votes

When I run selenium script for the opening gmail.com in Eclipse it does not get loaded and shows an error: "The connection has timed out the server at www.demo.guru99.com is taking too long to respond. "

Apr 17, 2018 in Selenium by Martin
• 4,220 points

edited Apr 17, 2018 by Martin 1,362 views

1 answer to this question.

0 votes

Try to use implicit waits to ensure that the objects are available to selenium.

Include this code in @BeforeTest or @BeforeSuite annotation which ensure the entire test suite will not run if this fails. You can also use try/catch to catch the error and throw exception. Choose whatever is best solution in your case

public static Boolean IsObjectExists(WebDriver driver, By locator) {

        driver.manage().timeouts().implicitlyWait(500, TimeUnit.MILLISECONDS);

        try {

            driver.findElement(locator);

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

            return true;

        } catch (NoSuchElementException e) {

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

            return false;

        }

answered Apr 17, 2018 by niki

Related Questions In Selenium

0 votes
1 answer

Java.lang.CharSequence cannot be resolved error while using sendKeys() using Selenium Webdriver

You could try this, myElement .sendKeys(new String[] { ...READ MORE

answered Apr 4, 2018 in Selenium by Johnathon
• 9,080 points
745 views
0 votes
1 answer

How to scroll the Page up or down in Selenium WebDriver? (using java)

Its pretty simple. Check out the below ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,110 points
8,366 views
0 votes
1 answer

How can I download the *.jar file from http:// seleniumhq.org using selenium WebDriver?

For Selenium Standalone Server use this: profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/java-archive"); and ...READ MORE

answered Apr 9, 2018 in Selenium by Martin
• 4,220 points
600 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,110 points
930 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
1,114 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
853 views
0 votes
1 answer

Headless ChromeDriver using Python Selenium error: Fails To Start— “DevTools request failed”

This should be because your ChromeDriver is ...READ MORE

answered Mar 29, 2018 in Selenium by nsv999
• 5,110 points
392 views
0 votes
1 answer