user_h
user_h

Reputation: 1

In Selenium 2: driver.switchTo().frame() causes Application to crash

I am using Selenium 2 and IE7.

There are a lot of iframes present in the application I am testing. So I am using driver.switchTo().frame() method to switch between iframes. I also use driver.switchTo().defaultContent() before switching to an iframe.

However in some cases, driver.switchTo().frame() causes the Application to crash. Below is the error in eclipse:

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: javaw.exe
  Application Version:  6.0.70.6
  Application Timestamp:    484e4780
  Fault Module Name:    IEDriver.dll
  Fault Module Version: 0.0.0.0
  Fault Module Timestamp:   4fdf5b90
  Exception Code:   c0000005
  Exception Offset: 0008a71e
  OS Version:   6.0.6001.2.1.0.274.10
  Locale ID:    1033
  Additional Information 1: 1699
  Additional Information 2: 3c7b32a427f0a23d017c01e406809b93
  Additional Information 3: 437a
  Additional Information 4: 0abbaf052c4358d69b1ef6b054f6ab09

I even tried getting the source of the iframe by, driver.findElement(By.id(iframeID)).getAttribute("src"), and i am able to get the source of iframe. I have also tried to introduce wait between switching of iframes but still it gives the same error. I do not know why it is causing the application to crash as it is working for some cases.

Does anyone have any similar experience or can think of any solution??

Upvotes: 0

Views: 2702

Answers (1)

Serzhio
Serzhio

Reputation: 11

I am using this code to choose iframe by src and it works:

driver.switchTo().frame(driver.findElement(By.cssSelector("iframe[src=\"SRC_OF_FRAME\"]"))); 

Upvotes: 1

Related Questions