'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,330 points

edited Apr 17, 2018 by Martin 3,323 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,090 points
1,607 views
0 votes
2 answers

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

JavascriptExecutor jsx = (JavascriptExecutor)driver; jsx.executeScript("window.scrollBy(0,555)", ""); or Action classes ...READ MORE

answered Sep 5 in Selenium by Sri
• 2,970 points
13,263 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,330 points
1,175 views
0 votes
2 answers

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,510 points
3,525 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
4,533 views
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,890 points
2,595 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2 in Selenium by Sri
• 2,970 points
2,862 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,510 points
693 views