Display results as :

Rechercher Advanced Search

Latest topics
» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

» Selecting the input for auto populating element
Sat Jul 29, 2017 7:53 pm by kdabbara


Switching between nested iframes within a frame

View previous topic View next topic Go down

Switching between nested iframes within a frame

Post by bhaskarvphani on Sun Apr 01, 2012 3:06 am

Please help me in resolving the following issue.

Hierarchy of Frameset, frames and iframes in a single web page

Frameset id=”mainframeset”….
frame id=”usersession”…
Frameset id=”lowerframeset”..
Frame id=”Nav”
Frameset =”main pane”…
Frame id=”Work”…
Iframe1 :(each Iframe have attributes frameborder="0",allowtransparency="true",tabindex="0",src="",title="Rich text editor, work_135(only change is this id for each iframe), press ALT 0 for help.",style="width:100%;height:100%"
Iframe2: (each Iframe have attributes frameborder="0", allowtransparency="true",tabindex="0",src="",title="Rich text editor, work_140(only change is this id for each iframe), press ALT 0 for help.",style="width:100%;height:100%"

Code I have is :

System.out.println(" Switched to Work ");
List Element = driver.findElements(By.xpath("//iframe"));
System.out.println("No of Iframes are :"+ Element.size());
driver.findElement(By.xpath("//*[@id='ck_article_title']/p[1]")).sendKeys("Ifram 1 ");

driver.findElement(By.xpath("//*[@id='ck_article_standfirst']/p[1]")).sendKeys("I frame 2 ");

Error while running the above code:

Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: Element belongs to a different frame than the current one - switch to its containing frame to use it


a) The above code enters the text in iframe 1 but gives above error when trying to identify iframe2 within frame "work"

Please help me to identify each iframes sequentially and enter required text in it.


Posts : 1
Join date : 2012-03-27

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum