Dashboard > Selenium > ... > Contributed User-Extensions > selectFrame
Selenium Log In View a printable version of the current page.
selectFrame
Added by Paul Hammant, last edited by Nelson Sproul on Jan 20, 2007  (view change)
Labels: 
(None)

description

select a frame to test the components in it

===================================================================================
DO NOT USE THIS EXTENSION: instead use the standard selectFrame method which is now included in standard selenium.
===================================================================================

  • target:the name of frame to test

example of use

selectFrame frameName  
click buttonInFrame  

......
other actions in the frame
......

selectFrame null  

selectFrame(null) means returning control back to myiframe

notes

  • Don't set the attribute "target" of form in frame to "_Top".This will replace selenium with AUT."_Parent" maybe what you need.
  • Because of my limitation in ability, I had to change two core files of selenium,selenium-browserbot.js and selenium-executionloop.js.
  • For supplying the function to view dom tree of frame, I made some changed in TestRunner.html.
  • Thanks alexandre Garel for the command "include".Very nice job!
  • Because of using "include" in my tests,please put selenium under some server before running them.

download

selectFrame v1_1 for 0.6
selectFrame v1_1 for the latest src

intoduction about the modifications of the core files

  • selenium-browserbot.js
    • In function BrowserBot.prototype.modifySeparateTestWindowToDetectPageLoads,I add some code which adds onload listener to the frame to select in function BrowserBot.prototype.callOnFramePageTransition which is in user-extensions.js.So all "ActionAndWait" in frame become work.
    • In function KonquerorBrowserBot.prototype.pollForLoad ,I add "try...catch..." around the line "var sameDoc = (originalDocument ===
      windowObject.document);".The reason is because "permission denied" alert was always jumping out when the page was changing in selected frame.When I chose not to debug the error,selenium worked fine.I thought when the page was changing,we couldn't access the document of previous page which had been changed.I don't know how to work around it So I add "try...catch..."
  • selenium-executionloop.js
    • I add the expression "if (!this.waitForCondition)return;" in pollUntilConditionIsTrue because waitForCondition maybe null when the current window is frame.

  • Your modifications in selenium-browserbot.js and selenium-executionloop.js are not easy to merge with the latest SVN. At least the first seams to be tagged "//modify by wangjun" ?
  • There is a new version of include. By the way, it was not clear to me that includeCommand's user-extension.js was indeed included in your user-extension.js ...

First Thanks for using selectFrame.
Sorry!Bruno.selectFrame command is only for Selenium 0.6.Since 0.6 Selenium has changed so much.I wouldn't merge selectFrame into the latest Selenium untill 0.7 comes.Maybe you can do it for us!

I used include command created by Alex for the test of selectFrame.So I think there is no nessesary to include the latest one of include in selectFrame command.
Good Luck!

James, thanks for addressing an important problem.

I cannot get the fix fully working however and after I integrate it into Selenium 0.6, the selectWindow command stop working! I'm not sure what is wrong, as all the other tests seem to be working. I'd appreciate your input on this issue.

Posted by Victor at Mar 23, 2006 10:50

Hi James !

I am trying to use this extension,but I am getting the following error :-

 [error] Unexpected Exception: message -> Unknown command: 'selectFrame', fileName -> chrome://selenium-ide/content/selenium/selenium-executionloop.js, lineNumber -> 59, stack -> Error("Unknown command: 'selectFrame'")@:0 ()@chrome://selenium-ide/content/selenium/selenium-executionloop.js:59 ()@chrome://selenium-ide/content/selenium/selenium-executionloop.js:32 ()@chrome://selenium-ide/content/selenium/selenium-executionloop.js:144 continueCurrentTest()@chrome://selenium-ide/content/selenium-runner.js:262 (true)@chrome://selenium-ide/content/debugger.js:101 ("cmd_selenium_step")@chrome://selenium-ide/content/selenium-ide.js:98 doCommand("cmd_selenium_step")@:0 goDoCommand("cmd_selenium_step")@chrome://global/content/globalOverlay.js:93 oncommand([object MouseEvent])@chrome://selenium-ide/content/selenium-ide.xul:1 @:0 , name -> Error

I replaced the original  user-extensions.js, and selenium-browserbot.js files  with those attached in the above attachment.

Let me know why is this error occuring? 

Posted by Nitin at Apr 18, 2006 04:54

Hi,
I am using selectFrame. Under the Command it is selecFrame. And under Target it is right. When I run the test I see the following error. [error] Element right not found. Can you help me please?
Thanks alot. Ramdas

Posted by Ramdas at Jan 25, 2007 11:04
Site running on a free Atlassian Confluence Community License granted to OpenQA. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.6 Build:#812 Aug 06, 2007) - Bug/feature request - Contact Administrators