New issue
Advanced search Search tips

Issue 2209 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 1819
Owner: ----
Closed: Jan 2018



Sign in to add a comment

Unable to switch to frame when HTML is inside the chrome extension

Reported by nj.cha...@gmail.com, Jan 6 2018

Issue description

Chrome version:
Version 63.0.3239.132 (Official Build) (64-bit)

Selenium version:
3.7.1

Chromedriver version:
2.34.522932

platform:
Mac OS X 10.13.2 x86_64

When identifying iframe getting the below exception:
org.openqa.selenium.NoSuchFrameException: no such frame: element is not a frame
  (Session info: chrome=63.0.3239.132)
  (Driver info: chromedriver=2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e),platform=Mac OS X 10.13.2 x86_64) (WARNING: The server did not provide any stacktrace information)

HTML Snippet:
<iframe class="WFGLES" src="chrome-extension://mkohpoohibhpokkgakkogklcgcbnmoob/editor.html" id="wfx-editor-iframe" style=" width: 900px !important; height: 522px !important;"></iframe>

It was working fine when HTML was not inside the chrome extension.

 
Screen Shot 2018-01-06 at 8.48.15 AM.png
128 KB View Download
Labels: Needs-Feedback
Please before loading the frame put some sleep in your code.
If it doesn't help kindly please share your code.

It is not an issue with the synchronization of the element. I tested it with sleep and on debug mode on the IDE. Here's the code.
        
        WebElement ele = driver.findElement(By.id("wfx-editor-iframe"));
        driver.switchTo().defaultContent();
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        driver.switchTo().frame(ele);
Could you please share your code?
What is the extension with the HTML file?

I have attached the screenshot above, the extension is .html. I shared my code above.
Please attach the HTML file, not the screen shot. We need to run on our side to see if we get a repro.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<iframe class="WFGLES" src="chrome-extension://mkohpoohibhpokkgakkogklcgcbnmoob/editor.html" id="wfx-editor-iframe" style=" width: 900px !important; height: 522px !important;"></iframe>
</body>
</html>

This is added as a feature in chromedriver 2.30 here: https://sites.google.com/a/chromium.org/chromedriver/downloads
"Allows access to chrome extension within iframe."

I have all the latest dependencies.
Chrome version:
Version 63.0.3239.132 (Official Build) (64-bit)

Selenium version:
3.7.1

Chromedriver version:
2.34.522932

The following code runs without any issues with the above given HTML file:

...
  static WebDriver driver;
  static WebElement ele;

  public static void main(String[] args) {
    try
    {
      driver = new ChromeDriver();
      driver.get("file://<path_to_html_file>");
      ele = driver.findElement(By.id("wfx-editor-iframe"));
      driver.switchTo().defaultContent();
      Thread.sleep(10000);
    }
    catch (InterruptedException e)
    {
      System.out.println("!!! Exception:");
      System.out.println(e);
      e.printStackTrace();
    }

    driver.switchTo().frame(ele);
  }
...
I tried both with file://chrome-extension://<html> and file://<html>, both didn't work.

1. driver.get("file://ohkeehjepccedbdpohnbapepongppfcj/editor.html")
Error on browser
Your file was not found
It may have been moved or deleted.
ERR_FILE_NOT_FOUND

2. driver.get("file://chrome-extension://ohkeehjepccedbdpohnbapepongppfcj/editor.html")
org.openqa.selenium.WebDriverException: unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot navigate to invalid URL"}
  (Session info: chrome=63.0.3239.132)
  (Driver info: chromedriver=2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e),platform=Mac OS X 10.13.2 x86_64) (WARNING: The server did not provide any stacktrace information)

I'm going to add steps to reproduce here.

1. launch driver (install extension using chromeoptions -> options.addExtensions(new File(this.getClass().getClassLoader().getResource("test.crx").toURI()));)
2. Open any page (e.g. https://google.com)
3. Invoke extension
4. Locate iframe by id/tag name... doesn't matter -> iframe can be located
5. Execute driver.switchTo().frame(iframe_web_element)
6. Observe result
Like you may see from my codes I am running a static main() method with static members in the class. And static member functions can't have 'this' pointer.
In your example you use a 'this' pointer which means you are using a different code.
Please share your code so we could run exactly the same code on our side.
Also please attach the test.crx extension file, so we could use it.

Comment 13 Deleted

Thank you. 


Status: Untriaged (was: Unconfirmed)
I was able to get a repro of this issue.

Console logs:

Jan 08, 2018 4:14:36 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.NoSuchFrameException: no such frame: element is not a frame
  (Session info: chrome=63.0.3239.132)
  (Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.4.0-103-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds

--------

Chromedriver log file is attached:

Issue2209_chromedriver.log
41.1 KB View Download
Mergedinto: 1819
Status: Duplicate (was: Untriaged)

Sign in to add a comment