1

We use different profiles to test different features of our system. If we open new multiple FF sessions (each with it's own profile), Selenium Webdriver only uses 1 window handle identifier.

(pseudo code below)

WebDriver driver1 = new FirefoxDriver(Profile1);

WebDriver driver2 = new FirefoxDriver(Profile2);

WebDriver driver3 = new FirefoxDriver(Profile3);

String h1 = driver1.getWindowHandle();

String h2 = driver3.getWindowHandle(); 

String h3 = driver3.getWindowHandle(); 

EVERY ONE of the window handles will be identical, even though these were new sessions with unique profiles. (That is, h1 == h2 == h3 )

Am I missing something here? I would have thought that the handles would be unique for each window?

-Dennis

0

It shouldn't happen given, at least I cannot reproduce your issue:

enter image description here

each time the handle represents an unique GUID structure.

Consider the following checklist:

  1. Make sure you use thread-safe collections, functions and patterns
  2. Avoid using static fields
  3. Implement thread-local storage pattern at least for WebDriver class instances

Check out Parallel Tests Execution article for more details and example sample project you can use as the reference.

  • Hi Dmitri, thanks for the info. I inherited a lot of code, and some of it is a class that extends FireFoxDriver, with some static methods. I'll investigate the implications of that and your other suggestions. Best regards, Dennis – Dennis Reda May 17 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.