Thank you for your kind words: it's great to hear that you've managed
to get up and running with it so quickly! :)
In answer to your question: the only drivers where you'll see the
expected behaviour you want is with the Firefox and HtmlUnit drivers.
The reason for this is that we are tied to the behaviour of the
underlying browsers. With Firefox we can simply create a new,
temporary profile per instance, and HtmlUnit works in isolation too.
OTOH, Internet Explorer quite reasonably expects that only one user
will be using it. As a result it will share a lot of data, in
particular in the form of cookies, between running instances. This
makes the "side by side" testing hard to do with, though if you can
live with the limitation that only one user can be logged in at a time
(effectively chatting to themselves) the IE driver should work fine
too.
Regards,
Simon
--Nat
2008/11/9 Simon Stewart <simon.m...@gmail.com>:
Simon
Just call the normal FirefoxDriver constructor: you don't need to
specify the port yourself, even when you want multiple versions of the
Firefox driver running at the same time. Are you using the downloaded
JARs or running off the latest version built from source? We recently
closed a bug to do with starting multiple instances of Firefox at the
same time, but we've yet to do a full release.
One important thing to bear in mind is that WebDriver has not been
written to be thread safe. You should be okay using a driver per
thread, but not one driver for many threads.
The way that I've written the tests that you're attempting to write
before has been to instantiate both instances in the same thread and
then hand control back and forth between them, like so:
WebDriver first = new FirefoxDriver();
first.get(url);
WebDriver second = new FirefoxDriver();
second.get(url);
String original = first.findElement(by).getText();
second.findElement(by).click();
String newValue = first.findElement(by).getText();
assertTrue(!original.equals(newValue));
I hope that helps!
Regards,
Simon
The "Unable to bind to locking port" is the key. The way that the
firefox driver works is that the java side of the code talks to a
firefox extension over a socket. Only one process at a time can be
bound to any particular (server) socket, and each instance of the
firefox driver is a new process; this means that we need some
synchronization mechanism that works not only within the same JVM, but
also across JVMs and, indeed, languages. To complicate matters
further, this process needs to be atomic and be available on every
supported OS.
The mechanism we use is bind to a "well known" port. Since we don't
know what ports you, as a user, have permission to bind to, we base
this off the port that you've told the profile to use. We do this by
subtracting one. In pseudo-code, the process to launch looks like:
lock = bindToWellKnownSocket();
port = findNextFreePortBasedOnProfilesPortProperty();
startFirefox(port);
releaseSocket(lock);
So, if you've told one profile to use "3000" and the next to use
"3001" the first profile will start. The second will attempt to bind
to port 3000 (3001 - 1) as the well-known port. Sadly, the first
profile is already running on this port, so the second profile times
out. The solution is to either not set the port on the profile (in
which case firefox binds to the first available port starting from
7055) or to set it to the same value for every profile.
In other words, the "port" argument is treated as a recommendation
rather than an absolute value.
Does that help clear things up? If you're still having trouble, then
it sounds like you've managed to find a bug, which I need to fix. If
so, could you please let me know which OS you're on? The Service Pack
number would be useful if you're on Windows too (I suspect you're on
XP SP3, but I've been wrong before :)
Regards,
Simon
--
You received this message because you are subscribed to a topic in the Google Groups "webdriver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/webdriver/LNfQ-0HPEh0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver.
For more options, visit https://groups.google.com/groups/opt_out.