Selenium 1 - switch to iframe without ID -
the page crape have removed id iframe, have problem switching iframe, , can't find documentation me, maybe there here on stack?
the url of page is: http://www.klappen.se/boka/onlinebokning/
i'm using selenium 1 , code looks this:
$this->_driver->switchto()->getframebyname("mainframe");
in targetlocator.php have these functions:
<?php // copyright 2012-present nearsoft, inc // licensed under apache license, version 2.0 (the "license"); // may not use file except in compliance license. // may obtain copy of license @ // http://www.apache.org/licenses/license-2.0 // unless required applicable law or agreed in writing, software // distributed under license distributed on "as is" basis, // without warranties or conditions of kind, either express or implied. // see license specific language governing permissions , // limitations under license. namespace seleniumclient; require_once 'webdriver.php'; class targetlocator { private $_driver; public function __construct(webdriver $driver) { $this->_driver = $driver; } #region targetlocator members /** * move different frame using index * @param integer $frameindex * @return current webdriver */ public function getframebyindex($frameindex) { $this->_driver->getframe($frameindex); return $this->_driver; } /** * move different frame using name * @param string $framename * @return current webdriver */ public function getframebyname($framename) { //we should validate framename string /* if ($framename == null) { throw new argumentnullexception("framename", "frame name cannot null"); } */ $this->_driver->getframe($framename); return $this->_driver; } /** * move frame element. * @param webelement $frameelement * @return current webdriver */ public function getframebywebelement(webelement $frameelement) { //we should validate frameelement string /* if (frameelement == null) { throw new argumentnullexception("frameelement", "frame element cannot null"); } remotewebelement convertedelement = frameelement remotewebelement; if (convertedelement == null) { throw new argumentexception("frameelement cannot converted remotewebelement", "frameelement"); } */ $frameid = $frameelement->getelementid(); $target = array('element' => $frameid); $this->_driver->getframe($target); return $this->_driver; } /** * change window passing in name * @param string $windowname * @return current webdriver */ public function getwindow($windowname) { $this->_driver->getwindow($windowname); return $this->_driver; } /** * change active frame default * @return current webdriver */ public function getdefaultframe() { $this->_driver->getframe(null); return $this->_driver; } /** * finds active element on page , returns * @return webelement */ public function getactiveelement() { $webelement = null; $webelement = $this->_driver->getactiveelement(); return $webelement; } /** * switches active modal dialog particular driver instance. * @return \seleniumclient\alert */ public function getalert() { // n.b. execute getalerttext command able throw // noalertpresentexception if there no alert found. //$this->_driver->getalerttext(); return new alert($this->_driver); //validate alert object can created, if not throw exception, try use factory singleton o depency of injection use 1 instance } #endregion }
i have tried them all, can't work. there out there can help:-)?
thanks in advance.
as far see looking iframe:
<iframe src="http://dlbookit3.dlsystems.se/dlbookitksr/bmlogifilt/logifilt.aspx" style="height:700px; width:100%; border:0;"></iframe>
right? have method getframebywebelement(webelement)
accepts webelement
. think can use xpath
find webelement
e.g.:
webelement element = find(by.xpath("//iframe")); getframebywebelement(element);
so far in theory work (this java, have adapt php code). if analyze html code of page chrome cannot locate webelement
using xpath //iframe
.
still can try... looks page owner doesn't want iframe
locateable anymore :-)
Comments
Post a Comment