Issue 3543 in selenium: Firefox webdriver driver.getTitle() sometimes returns empty string

22 views
Skip to first unread message

sele...@googlecode.com

unread,
Mar 12, 2012, 11:56:48 PM3/12/12
to selenium-develope...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 3543 by ja...@cavanaugh.co.nz: Firefox webdriver
driver.getTitle() sometimes returns empty string
http://code.google.com/p/selenium/issues/detail?id=3543


What steps will reproduce the problem?
1. Create a test which navigates through pages, each time checking the page
title is set correctly. Or simply output the title on each page:

private void titleDebug(final String pageName) {
System.out.println(pageName + ":" + driver.getTitle());
System.out.println(pageName + "2:" + driver.getTitle());
}

2. Sometimes the output looks like:

...
changeDetailsConfirmed:
changeDetailsConfirmed2:change your contact details confirmed
...

Note that nothing has changed between calls (except maybe a few
milliseconds)

This doesn't happen everytime, can happen up to 1 in four attempts. It has
been reproduced on two separate PCs.

I haven't been able to reproduce using chrome or IE.

Selenium version: 2.19.0
OS: Windows 7
Browser: Firefox
Browser version: 10.0.2


sele...@googlecode.com

unread,
Mar 13, 2012, 5:08:40 PM3/13/12
to selenium-develope...@googlegroups.com

Comment #1 on issue 3543 by kristian...@gmail.com: Firefox webdriver
driver.getTitle() sometimes returns empty string
http://code.google.com/p/selenium/issues/detail?id=3543

This issue may be fixed for 2.21, please test

sele...@googlecode.com

unread,
Apr 3, 2012, 1:17:58 PM4/3/12
to selenium-develope...@googlegroups.com

Comment #2 on issue 3543 by martinho...@gmail.com: Firefox webdriver
driver.getTitle() sometimes returns empty string
http://code.google.com/p/selenium/issues/detail?id=3543

Same Issue using 2.20.0.
workaround - add a Thread.sleep(1500) before the call to driver.getTitle()

sele...@googlecode.com

unread,
May 10, 2012, 5:06:40 PM5/10/12
to selenium-develope...@googlegroups.com
Updates:
Status: NeedsClarification
Labels: Component-WebDriver Browser-Firefox

Comment #3 on issue 3543 by barancev: Firefox webdriver driver.getTitle()
This issue may be fixed in 2.21, please test

sele...@googlecode.com

unread,
Jun 22, 2012, 10:25:00 AM6/22/12
to selenium-develope...@googlegroups.com

Comment #4 on issue 3543 by haral...@gmail.com: Firefox webdriver
driver.getTitle() sometimes returns empty string
http://code.google.com/p/selenium/issues/detail?id=3543

I have experienced this issue with 2.21.0, on OS X Lion with a very old
Firefox (3.6.22). One of my tests fails in ~50% of runs on that
configuration.

I have recently also experienced the issue on our CI server, which runs
Linux with a somewhat newer Firefox (10.0.4).

I have so far been unable to reproduce the error on OS X Lion with the most
recent Firefox (13.0.1).

According to http://seleniumhq.org/docs/03_webdriver.html#firefox-driver
Firefox 3.6, 10 and latest should all be supported. So, is there any hope
for making .getTitle() work reliably also on older versions of Firefox?

sele...@googlecode.com

unread,
Jun 25, 2012, 9:41:07 AM6/25/12
to selenium-develope...@googlegroups.com
Updates:
Status: WorkingAsIntended

Comment #5 on issue 3543 by dawa...@gmail.com: Firefox webdriver
driver.getTitle() sometimes returns empty string
http://code.google.com/p/selenium/issues/detail?id=3543

This presumably happens after clicking, or submitting a form.

These API calls are asynchronous; you should use a WebDriverWait to wait
for the title you expect (or to wait for it not to be empty), to poll until
the page has actually loaded.

sele...@googlecode.com

unread,
Jun 25, 2012, 10:07:03 AM6/25/12
to selenium-develope...@googlegroups.com

Comment #6 on issue 3543 by haral...@gmail.com: Firefox webdriver
driver.getTitle() sometimes returns empty string
http://code.google.com/p/selenium/issues/detail?id=3543

The test I have that is failing intermittently on older Firefoxen, does:

1. findElement(<a href to some other page>).click()
2. assert that .getTitle on the new page looks as expected

The new page's title is present in the HTML from the start, without any
javascript magic needing to happen.

According to the documentation of WebElement.click()
(http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebElement.html#click()),
WebDriver will "attempt to block until the page has loaded".

Are you saying that this is not the case -- i.e. that calling .click() on a
link will not block? If so, shouldn't the documentation be updated?

sele...@googlecode.com

unread,
Jul 5, 2012, 5:53:56 PM7/5/12
to selenium-develope...@googlegroups.com

Comment #7 on issue 3543 by dawa...@gmail.com: Firefox webdriver
driver.getTitle() sometimes returns empty string
http://code.google.com/p/selenium/issues/detail?id=3543

It will attempt to block, but it makes no guarantees, because it doesn't
know what "loaded" is - is a page loaded if it has ajax pending, which may
be forever, for example? So the recommendation is to explicitly wait for
some signal you deem to mean the page is loaded, e.g. having the correct
title.

I will mention this in the javadoc

sele...@googlecode.com

unread,
Jul 6, 2012, 4:53:07 PM7/6/12
to selenium-develope...@googlegroups.com

Comment #8 on issue 3543 by chinmayb...@gmail.com: Firefox webdriver
driver.getTitle() sometimes returns empty string
http://code.google.com/p/selenium/issues/detail?id=3543

So we were facing the same issue with webdriver 2.20 and firefox. As
suggested we upgraded to webdriver 2.24.1 but the issue was not completely
resolved. However it appeared to occur lesser number of times.
Suggested workaround is to add a wait time ( Page load wait time) after an
action on the page, such as a "click", regardless of whether the click
returns a new page or just does something on the same page itself. As of
now, a wait time of 1000 ms is working for us.
This isnt a permanant solution though, just informing that upgrading to
selenium 2.24 did not resolve the problem.


Reply all
Reply to author
Forward
0 new messages