Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8610219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:04:36+00:00 2026-06-12T04:04:36+00:00

Currently I have a problem – I want to switch out of current frame

  • 0

Currently I have a problem – I want to switch out of current frame to parent. Application have a lot of of inner frames, so using driver.switchTo().defaultContent() is not the case. In this discussion possible solution is suggested – you should remember all frames you visited and and iterate over them from the top using

driver.switchTo().defaultContent()

The main problem is in that fact, that in my application I, sometimes, forced to use switching to frames located by xpath and other locators – use switch by WebElement. And as it is already mentioned in discussion above after switching all located WebElement becomes invalid and can’t be used for switching. So I should have some way to find this element inside frame again. Although i can locate index of this frame element executing some js calls(i.e (WebElement)executeScript("window.frames[i]").equals(myWebElement)), but it is not the case as index may change when some frames deleted from page. Either I can try to find frame names and id’s but they may not be specified.

So I see the only possible solution – set some attribute to frames that parent of currently selected – for Example attribute active with value true. Also I should be able to do this for all methods that can switch frame (there exist 3). In all methods I can receive WebElement representing frame, but as far as I know to change attribute value you should execute some js code. So the problem is how to locate current WebElement in js.

Thanks for reading this all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:04:37+00:00Added an answer on June 12, 2026 at 4:04 am

    look at this code snippet above.that’s the best way you can locate the current element in Js
    passing the element as an argumet to execute script and referring to it in js using arguments[0]

    WebElement element = driver.findElement(By.id("foo"));
    String contents = (String)((JavascriptExecutor)driver).executeScript("return arguments[0].innerHTML;", element); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a problem within PHP where I want to sort these posts
I currently have collision between 2 sprites working, using sprite.collidesWith(otherSprite) . The problem is
im currently creating a graph for an app, using coreplot and have a problem
i'm currently have a problem by using the SetTimeOut function. The thing is that
Currently I am working with: C# Windows forms application I currently have a problem
i have a problem in using intents there are 5 activities in the application
Hi currently have the problem, that I want to insert values in a postgres
I everyone. I currently have a problem with my focus when using a splash
I currently have a problem with my jgroups configuration, causing thousands of messages getting
I currently have a problem attepting to update a record within my database. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.