Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are switching from Selenium RC to Webdriver, but most of the commands after converting in to Webdriver are not working .

The web driver statement for selenium.selectwindow(" title") is driver.switchTo().window(v2); is not working (String v2=driver.getWindowHandle();) and getting exception as

org.openqa.selenium.NoSuchFrameException: Unable to locate frame: {c4fea83b-a784-4278-a490-762bdf80a7df}

Kindly suggest.


share|improve this question
tried with (String winHandle : driver.getWindowHandles()) { driver.switchTo().window(winHandle); } but its throwing exception "Unable to locate element". – user2787080 Jun 26 '14 at 7:16

The getWindowHandle() function returns the current window, I think you cannot switch to the current window.

You want to use getWindowHandles() to find other windows.

For an example and similar issue see:

share|improve this answer

This is how I implemented a quick utility function to switch to a window based on the title:

public static void switchToWindowWithTitle(String title, WebDriver driver) {
    Set<String> windowHandles = driver.getWindowHandles();
    for(String handle : windowHandles){  
        if (driver.getTitle().contains(title)) {

This iterates over the window handles looking for the right one, and switches to it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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