Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

HttpHostConnectException thrown if closing a popup while in debugger. #1378

Closed
lukeis opened this issue Mar 2, 2016 · 4 comments
Closed

Comments

@lukeis
Copy link
Member

lukeis commented Mar 2, 2016

Originally reported on Google Code with ID 1378

What steps will reproduce the problem?
1. Use this test case:

    @Test
    public void testPopupClose() {
        WebDriver driver = new FirefoxDriver();
        driver.get( "http://lucastheisen.com/test/lucas_test_page.html" );
        driver.findElement( By.id( "popup_link" ) ).click();

        String mainWindowHandle = driver.getWindowHandle();
        System.out.println( "currentWindowHandle='" + mainWindowHandle + "'" );
        boolean foundPopup = false;
        for ( String windowHandle : driver.getWindowHandles() ) {
            if ( !windowHandle.equals( mainWindowHandle ) ) {
                System.out.println( "checking '" + windowHandle + "' for taunt" );
                driver.switchTo().window( windowHandle );
                try {
                    driver.findElement( By.id( "taunt" ) );
                    foundPopup = true;
                    break;
                }
                catch ( NoSuchElementException e ) {
                    System.out.println( "'" + windowHandle + "' is not taunt window"
);
                }
                finally {
                    if ( !foundPopup ) {
                        driver.switchTo().window( mainWindowHandle );
                    }
                }
            }
        }

        if ( foundPopup ) {
            System.out.println( "found my popup, now try to close it..." );
            driver.close();
        }

        //****************************************
        System.out.println( "SET BREAKPOINT ON THIS LINE" );
        //****************************************

        driver.switchTo().window( mainWindowHandle );
        driver.findElement( By.id( "popup_link" ) );
        driver.close();

        assertTrue( true );
    }

2. Set a breakpoint on the indicated line.
3. Run the test case with the debugger.

What is the expected output? What do you see instead?

I would expect to be able to step through this code with no problem.  Instead, if the
debugger is stopped between the driver.close() on the popup window and the driver.switchTo().window(
mainWindowHandle ), I get this:

    org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException:
Connection to http://127.0.0.1:7056 refused
    System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version:
'1.6.0_24'
    Driver info: driver.version: RemoteWebDriver
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:407)

What version of the product are you using? On what operating system?

I am using this:

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>2.0b2</version>
        <type>jar</type>
        <scope>test</scope>
    </dependency>

My operating system is 64 bit Windows 7 Ultimate.

Please provide any additional information below.

Reported by lucastheisen on 2011-03-09 19:32:01

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by barancev on 2011-10-12 20:24:13

  • Labels added: Component-WebDriver

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Is this still valid with 2.15? 

If so, can you please provide that sample page again and which version of firefox you
were having a problem with?

Reported by luke.semerau on 2011-12-29 06:06:55

  • Status changed: NeedsClarification
  • Labels added: Browser-Firefox

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Closing this issue due to inactivity.

Reported by barancev on 2012-05-16 09:05:09

  • Status changed: WontFix

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by luke.semerau on 2015-09-17 18:12:04

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 2, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant