Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Provide a mechanism to know the current frame path like IWebDriver.CurrentWindowHandle in Selenium WebDriver #4305

Closed
lukeis opened this issue Mar 3, 2016 · 2 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 4305

This is a request to expose a new property in IWebDriver and implement it.

IWebDriver.CurrentFrame

Returns a string with the name of the current frame that the driver instance is working
on or an IWebElement instance of the frame itself.

This in combination with a property in IWebElement to calculate its path from root
(path is defined as the list of frame/iframes) will make element fetch and r-use more
intuitive.

Today we have cluttered code having to implement the same ourselves. In our pages,
we constatnly keep hold of UI objects (which are encapsulation over IWebElemnt instances)
from across iframes in a single page. Before using any of them we need to call int
a "Switch". To be able to call into a "Switch" we need to have calculated a "Path"
and stored it.

This calculate and switch consumes a lot of time and causes reliability issues as well.

Reported by ravindrarupadhya on 2012-07-25 05:43:32

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This is possible with the existing API.  We will not be adding a new method for it.

WebElement frameEl = driver.findElement(By.tagName("iframe"));
driver.switchTo().frame(frameEl);
// This will fail if frames are on different domains!
WebElement el = (WebElement) ((JavascriptExecutor) driver).executeScript(
    "return window.frameElement");
assert frameEl.equals(el)

Reported by jmleyba on 2012-07-26 15:53:47

  • Status changed: WontFix
  • Labels added: Type-Enhancement, Component-WebDriver
  • Labels removed: Type-Defect, Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:15:52

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant