phpunit-selenium
phpunit-selenium copied to clipboard
Not possible to select iFrame
Hi,
Isn't it possible to focus an iFrame? I've tried using $this->frame($frameId), but that causes an Error:
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: The frame could not be found (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 73 milliseconds Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-40-generic', java.version: '1.7.0_17' Session ID: 1289955686c1400124fa2cd973c6f8cf Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=LINUX, chrome.chromedriverVersion=26.0.1383.0, acceptSslCerts=false, javascriptEnabled=true, browserName=chrome, rotatable=false, locationContextEnabled=false, version=26.0.1410.63, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}]
I am using exactly this code:
$this->frame('inclusion');
on this markup:
<iframe id="inclusion" ... />
Are you sure isn't a synchronization problem? Can you try adding an $this->implicitWait(5000) or get the page source in that moment to check it?
I just tried adding an id to the frame, and now it works. But shouldn't it be possible to do something like this:
$frame = $this->byCssSelector('#frameContainer iframe');
$this->frame($frame->getId());
Or even pass a PHPUnit_Extensions_Selenium2TestCase_Element to $this->frame() ?
Should be possible by the protocol to pass directly an Element object: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/frame but the PHP driver on our side does not support this case yet. I will gladly merge a tested PR to add this feature.
On Mon, Apr 15, 2013 at 9:35 AM, Ole Kallehave [email protected]:
I just tried adding an id to the frame, and now it works. But shouldn't it be possible to do something like this:
$frame = $this->byCssSelector('#frameContainer iframe');$this->frame($frame->getId());
Or even pass a PHPUnit_Extensions_Selenium2TestCase_Element to $this->frame() ?
— Reply to this email directly or view it on GitHubhttps://github.com/sebastianbergmann/phpunit-selenium/issues/238#issuecomment-16371021 .
Giorgio Sironi (@giorgiosironi) http://giorgiosironi.com http://giorgiosironi.blogspot.com/
#240 will enable $this->frame($frame) for your example. But $this->frame($frame->getId()) won't work because the Server only accepts 4 cases: null: select default frame string: select html-id or html-name number: select frameCount (0 will select the first frame, 1 the second, etc.) WebElement Object: select the element / frame
So any number will be used as a frameCount.