Testcase: testShouldSwitchFocusToANewWindowWhenItIsOpenedAndNotStopFutureOperations failing

82 views
Skip to first unread message

deter

unread,
Jan 18, 2011, 3:25:01 AM1/18/11
to selenium-...@googlegroups.com
I updated code to 10998 revision and ran the command ./go

I am getting the below error:

go aborted!
org.apache.tools.ant.BuildException: Test org.openqa.selenium.firefox.FirefoxDriverTestSuite failed

Log from TEST-org.openqa.selenium.firefox.FirefoxDriverTestSuite.txt:

Testcase: testShouldSwitchFocusToANewWindowWhenItIsOpenedAndNotStopFutureOperations took 2.261 sec
    Caused an ERROR
Unable to locate window "result"
System info: os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-27-generic', java.version: '1.6.0_22'
Driver info: driver.version: RemoteWebDriver
org.openqa.selenium.NoSuchWindowException: Unable to locate window "result"
System info: os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-27-generic', java.version: '1.6.0_22'
Driver info: driver.version: RemoteWebDriver
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:131)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:110)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:398)
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.window(RemoteWebDriver.java:547)
    at org.openqa.selenium.WindowSwitchingTest.testShouldSwitchFocusToANewWindowWhenItIsOpenedAndNotStopFutureOperations(WindowSwitchingTest.java:48)
    at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
    at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
    at junit.extensions.TestSetup.run(TestSetup.java:27)
    at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
    at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
    at junit.extensions.TestSetup.run(TestSetup.java:27)


Complete log here : http://pastebin.com/j10z2u8n

tried several times to bring the focus to the wndow 'results'..but there is no such thing..

If it is a fault from my side could any one point me to what wrong i am doing?

Thanks in Advance

deter

unread,
Jan 18, 2011, 3:27:00 AM1/18/11
to selenium-...@googlegroups.com
Here are the details:
OS: Ubuntu 10.04LTS
Java Version: 1.6.0_22
Firefox version : 3.6.13
Running command from Ubuntu Built-in terminal

deter

unread,
Jan 19, 2011, 1:09:26 PM1/19/11
to selenium-...@googlegroups.com
First i thought this is problem with the focus..But here i found the issue:

xhtmlTest.html has a link like below:

<a name="windowOne" target="result" href="resultPage.html">Open new window</a>

And as per the
WindowSwitchingTest.testShouldSwitchFocusToANewWindowWhenItIsOpenedAndNotStopFutureOperations()

has the code like this:

driver.get(pages.xhtmlTestPage);
String current = driver.getWindowHandle();

driver.findElement(By.linkText("Open new window")).click();
assertThat(driver.getTitle(), equalTo("XHTML Test Page"));

driver.switchTo().window("result");

The particular line is failing because the window opened has title : "We Arrive Here"

Here is the screen shot of the window opened after clicking on "Open new window" link.


deter

unread,
Jan 19, 2011, 1:11:50 PM1/19/11
to selenium-...@googlegroups.com

Here is the clear screen shot..

Eran M.

unread,
Jan 19, 2011, 5:19:00 PM1/19/11
to selenium-...@googlegroups.com
Which window manager are you using? With all this Ubuntu customization, I can't tell if it's KDE or Gnome underneath.
I'd also suggest running the tests with Xvfb / Xvnc and making sure that you have a vanilla Firefox (as opposed to Iceweasel that ships with debian, I'm not sure what Ubuntu ships). If you still get this error, let me know.

Eran

On 19 January 2011 18:11, deter <aler...@gmail.com> wrote:

Here is the clear screen shot..

--
You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
To post to this group, send email to selenium-...@googlegroups.com.
To unsubscribe from this group, send email to selenium-develo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-developers?hl=en.

deter

unread,
Jan 23, 2011, 6:28:05 AM1/23/11
to selenium-...@googlegroups.com
Thanks Eran mes for your reply..

Here are more details:

Which window manager are you using? With all this Ubuntu customization, I can't tell if it's KDE or Gnome underneath.
I am using Ubuntu 10.4 with Gnome..I just installed the different theme..may be that confused you..Definitely it is not KDE :)


 
I'd also suggest running the tests with Xvfb / Xvnc and making sure that you have a vanilla Firefox (as opposed to Iceweasel that ships with debian, I'm not sure what Ubuntu ships). If you still get this error, let me know.

I am not sure what you mean by vanilla firefox? I asked the same question on firefox forums here is the link : http://support.mozilla.com/en-US/questions/778068..
I thought may be u r talking abt removing all the add-ons and working with the plain firefox so..I tried that also..Here is the screenshot of firefox profile i am using for building selenium : http://tinypic.com/r/f4h5zt/7

Now i am trying with the xvfb as u said..following the below link:
http://wiki.openqa.org/display/SRC/Selenium-RC+and+Continuous+Integration

Here is the screen shot of what i am doing:

http://tinypic.com/r/a8qyu/7

My question is : Why is the same test passing when i am running individually..but failing from build..

Waiting for replies..

Thanks in Advance

deter

unread,
Jan 23, 2011, 6:34:18 AM1/23/11
to selenium-...@googlegroups.com
Here is the log of TEST-org.openqa.selenium.firefox.FirefoxDriverTestSuite.txt: http://pastebin.com/qQ51ASUA

I am using the latest code from repository as on Jan 23 : 4:00 PM IST..

Thanks
Deter

Eran M.

unread,
Jan 23, 2011, 6:37:34 AM1/23/11
to selenium-...@googlegroups.com
Hi,

Some clarifications:
  • Vanilla Firefox: The Firefox version when you got to mozilla.org/firefox. Some Linux distributions (like Debian) re-distribute the same code base without the Mozilla branding and call it differently (Iceweasel) due to some copyright issues that surrounded the Firefox logo. Gnome may be distributing the same codebase but re-compile it for 64 bit - I'm not sure. The path I'm suggesting is to go to mozilla.org/firefox, download the latest version for Linux, unpack it into an isolated location in the filesystem (~/firefox) and add this location to the beginning of the $PATH, so it will be picked up first.
  •  There's no need to remove extensions from your ordinary Firefox profile - Selenium uses its own profiles.
You said the test is passing when you run the tests individually - how exactly are you executing it?

Which Ubuntu version are you using? On what architecture? (output of uname -a).

Eran

deter

unread,
Jan 23, 2011, 12:54:28 PM1/23/11
to selenium-...@googlegroups.com
You said the test is passing when you run the tests individually - how exactly are you executing it?
I have written a class to execute, here is the code and this is working perfectly..the same test case is failing when building from sources..Here in the below case i am using:
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-firefox-driver</artifactId>
      <version>2.0b1</version>
      <scope>compile</scope>
    </dependency>

Here is the code:

    public static void main(String[] args) {
        FirefoxDriver driver = new FirefoxDriver();
        driver.get("file:///home/ram/workspace/selenium/common/src/web/xhtmlTest.html");
        String current = driver.getWindowHandle();

        System.out.println("The value of current is " + current);


        driver.findElement(By.linkText("Open new window")).click();

        driver.switchTo().window("result");


    }


Which Ubuntu version are you using? On what architecture? (output of uname -a).

Linux ram-laptop 2.6.32-27-generic #49-Ubuntu SMP Wed Dec 1 23:52:12 UTC 2010 i686 GNU/Linux

Here is the screen shot of the firefox after installing from mozilla.org/firefox..Here i dont see ubuntu so assuming that it is vanilla firefoxHere is the screen shot of the firefox after installing from mozilla.org/firefox..Here i dont see ubuntu so assuming that it is vanilla firefox

I am using 32-bit ubuntu version..


 

deter

unread,
Jan 23, 2011, 1:02:05 PM1/23/11
to selenium-...@googlegroups.com
Here is the screen shot of the firefox i am using now: http://tinypic.com/r/nesub6/7

Still the build failing with same details..

It is making me sleepless nights.. :(

Thanks
Deter

Eran M.

unread,
Jan 25, 2011, 2:20:59 PM1/25/11
to selenium-...@googlegroups.com
As we discussed on IRC, I'll try re-producing it locally and update the list.

Eran

Eran M.

unread,
Feb 8, 2011, 5:25:14 AM2/8/11
to selenium-...@googlegroups.com, deter, Simon Stewart
To follow up on the original problem: This is a problem with the tests, not with the driver. Read on if you want to know why.

This failure is reproducible (on some machines) by just running the following tests:
HTML5Test
TemporaryFilesystemTest
WindowSwitchingTest

The culprit is the TemporaryFilesystemTest. This tests asks the TemporaryFilesystem class to delete all of the temporary files that were generated through it. It then also deletes the Firefox profile directory under /tmp, leaving the driver in an unstable test. The TemporaryFilesystem will be changed have, instead of a global state, a directory it will use for temporary file (with a default to /tmp or the equivalent on other platforms). Then, the test will be able to create an instance pointing to a directory other than the one containing the Firefox profile, so the driver will be usable after this test.

Eran

QA_manager

unread,
Feb 9, 2011, 9:22:10 AM2/9/11
to Selenium Developers
Eran, there are some parts of this that I don't understand:
- "leaving the driver in an unstable test" Should this be "unstable
state"?
- "The TemporaryFilesystem will be changed have" With this
beginning, I cannot understand the rest of the sentence.

On Feb 8, 5:25 am, "Eran M." <eran....@gmail.com> wrote:
> To follow up on the original problem: This is a problem with the tests, not
> with the driver. Read on if you want to know why.
>
> This failure is reproducible (on some machines) by just running the
> following tests:
> HTML5Test
> TemporaryFilesystemTest
> WindowSwitchingTest
>
> The culprit is the TemporaryFilesystemTest. This tests asks the
> TemporaryFilesystem class to delete all of the temporary files that were
> generated through it. It then also deletes the Firefox profile directory
> under /tmp, leaving the driver in an unstable test. The TemporaryFilesystem
> will be changed have, instead of a global state, a directory it will use for
> temporary file (with a default to /tmp or the equivalent on other
> platforms). Then, the test will be able to create an instance pointing to a
> directory other than the one containing the Firefox profile, so the driver
> will be usable after this test.
>
> Eran
>
> On 26 January 2011 04:20, Eran M. <eran....@gmail.com> wrote:
>
> > As we discussed on IRC, I'll try re-producing it locally and update the
> > list.
>
> > Eran
>

Eran M.

unread,
Feb 13, 2011, 12:22:59 AM2/13/11
to selenium-...@googlegroups.com

Note to self: don't post while jet-lagged.
Yes, the driver is left in an unusable state.
The second paragraph was supposed to start with "changed to have..". The change itself shows how the global state was removed-the changes to the test cases themselves should make it clear.

Reply all
Reply to author
Forward
0 new messages