Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
BarryMcDermott
Posts : 1
Join date : 2015-06-10

driver.switchTo().defaultContent();   returning error when using latest version of Chrome Empty driver.switchTo().defaultContent(); returning error when using latest version of Chrome

Wed Jun 10, 2015 6:26 pm
Hi,
I'm running a regression pack for an online app using Chrome Driver on Version 42.0.2311.90 m of Google Chrome, and am having issues when trying to return focus from an iFrame back to the main screen, i.e. upon hitting the line of code 
driver.switchTo().defaultContent();

This worked perfectly on earlier versions of Chrome, and still works fine on a colleagues pc which has Version 39.x.etc

Has anyone else encountered anything similar ?  If so, any help / advice / workaround would be greatly appreciated.

The code for the particular Java method is:

@When("I click the $buttonText button in AllFinanz")
public void clickButtonInAllFinanz(String buttonText) throws InterruptedException {
     System.out.println("[TEST] Clicking " + buttonText);
     try {
          // access inside iframe
          WebElement elementFrame = driver.findElement(By.xpath("//iframe[contains(@onload, 'riskAssessmentIframe')]"));
  driver.switchTo().frame(elementFrame);

           // click the button
           WebElement button = driver.findElement(By.xpath("//input[@value='" + buttonText + "']"));
           button.click();

           // return focus to main window
           driver.switchTo().defaultContent();

   Thread.sleep(sleepTime*5);
           System.out.println("[SUCCESS] Clicked button " + buttonText);

     } catch (org.openqa.selenium.NoSuchElementException e) {
          System.out.println("[FAILURE] Unable to click button " + buttonText);
     } catch (org.openqa.selenium.ElementNotVisibleException e) {
          System.out.println("[FAILURE] " + buttonText + " not visible");
     }
}


As stated all works fine up until the driver.switchTo().defaultContent(); line of code, where the following error is thrown back:
org.openqa.selenium.WebDriverException: unknown error: missing 'id' (Session info: chrome=42.0.2311.90) (Driver info: chromedriver=2.10.267521,platform=Windows NT 5.1 SP3 x86) (WARNING: The server did not provide any stacktrace information) System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.7.0_45' Driver info: driver.version: RemoteWebDriver


Again any help would be appreciated - I've ran out of ideas re workarounds and cant find any answers when googling.

Thanks,
Barry.
Back to top
Permissions in this forum:
You cannot reply to topics in this forum