robotframework遇到iframe和frame的区别iframe怎么办

iframe与主框架跨域相互访问方法 - CSDN博客
iframe与主框架跨域相互访问方法
iframe 与主框架相互访问方法
1.同域相互访问
假设A.html 与 b.html&domain都是localhost (同域)
A.html中iframe 嵌入 B.html,name=myframe
A.html有js function fMain()
B.html有js function fIframe()
需要实现 A.html 调用 B.html 的 fIframe(),B.html 调用 A.html 的 fMain()
&!DOCTYPE HTML PUBLIC &-//W3C//DTD HTML 4.01 Transitional//EN& &http://www.w3.org/TR/html4/loose.dtd&&
&meta http-equiv=&content-type& content=&text/ charset=utf-8&&
&title& main window &/title&
&script type=&text/javascript&&
// main js function
function fMain(){
alert('main function execute success');
// exec iframe function
function exec_iframe(){
window.myframe.fIframe();
&p&A.html main&/p&
&p&&input type=&button& value=&exec iframe function& onclick=&exec_iframe()&&&/p&
&iframe src=&B.html& name=&myframe& width=&500& height=&100&&&/iframe&
&!DOCTYPE HTML PUBLIC &-//W3C//DTD HTML 4.01 Transitional//EN& &http://www.w3.org/TR/html4/loose.dtd&&
&meta http-equiv=&content-type& content=&text/ charset=utf-8&&
&title& iframe window &/title&
&script type=&text/javascript&&
// iframe js function
function fIframe(){
alert('iframe function execute success');
// exec main function
function exec_main(){
parent.fMain();
&p&B.html iframe&/p&
&p&&input type=&button& value=&exec main function& onclick=&exec_main()&&&/p&
点击A.html 的 exec iframe function button,执行成功,弹出iframe function execute success。如下图
点击B.html 的 exec main function button,执行成功,弹出
main function execute success。如下图
2.跨域互相访问
假设 A.html domain是
localhost, B.html domain 是
127.0.0.1&(跨域)
这里使用 localhost 与 127.0.0.1 只是方便测试,localhost 与 127.0.0.1已经不同一个域,因此执行效果是一样的。
实际使用时换成
A.html中iframe 嵌入 B.html,name=myframe
A.html有js function fMain()
B.html有js function fIframe()
需要实现 A.html 调用 B.html 的 fIframe(),B.html 调用 A.html 的 fMain() (跨域调用)
如果使用上面同域的方法,浏览器判断A.html 与 B.html 不同域,会有错误提示。
Uncaught SecurityError: Blocked a frame with origin &http://localhost& from accessing a frame with origin &http://127.0.0.1&.
Protocols, domains, and ports must match.
实现原理:
因为浏览器为了安全,禁止了不同域访问。因此只要调用与执行的双方是同域则可以相互访问。
首先,A.html 如何调用B.html的 fIframe方法
1.在A.html 创建一个 iframe
2.iframe的页面放在 B.html 同域下,命名为execB.html
3.execB.html 里有调用B.html fIframe方法的js调用
&script type=&text/javascript&&
parent.window.myframe.fIframe(); // execute parent myframe fIframe function
这样A.html 就能通过 execB.html 调用 B.html 的 fIframe 方法了。
同理,B.html 需要调用A.html fMain方法,需要在B.html 嵌入与A.html 同域的 execA.html&
execA.html 里有调用 A.html fMain 方法的js 调用
&script type=&text/javascript&&
parent.parent.fMain(); // execute main function
&/script&这样就能实现 A.html 与 B.html 跨域相互调用。
&!DOCTYPE HTML PUBLIC &-//W3C//DTD HTML 4.01 Transitional//EN& &http://www.w3.org/TR/html4/loose.dtd&&
&meta http-equiv=&content-type& content=&text/ charset=utf-8&&
&title& main window &/title&
&script type=&text/javascript&&
// main js function
function fMain(){
alert('main function execute success');
// exec iframe function
function exec_iframe(){
if(typeof(exec_obj)=='undefined'){
exec_obj = document.createElement('iframe');
exec_obj.name = 'tmp_frame';
exec_obj.src = 'http://127.0.0.1/execB.html';
exec_obj.style.display = 'none';
document.body.appendChild(exec_obj);
exec_obj.src = 'http://127.0.0.1/execB.html?' + Math.random();
&p&A.html main&/p&
&p&&input type=&button& value=&exec iframe function& onclick=&exec_iframe()&&&/p&
&iframe src=&http://127.0.0.1/B.html& name=&myframe& width=&500& height=&100&&&/iframe&
&!DOCTYPE HTML PUBLIC &-//W3C//DTD HTML 4.01 Transitional//EN& &http://www.w3.org/TR/html4/loose.dtd&&
&meta http-equiv=&content-type& content=&text/ charset=utf-8&&
&title& iframe window &/title&
&script type=&text/javascript&&
// iframe js function
function fIframe(){
alert('iframe function execute success');
// exec main function
function exec_main(){
if(typeof(exec_obj)=='undefined'){
exec_obj = document.createElement('iframe');
exec_obj.name = 'tmp_frame';
exec_obj.src = 'http://localhost/execA.html';
exec_obj.style.display = 'none';
document.body.appendChild(exec_obj);
exec_obj.src = 'http://localhost/execA.html?' + Math.random();
&p&B.html iframe&/p&
&p&&input type=&button& value=&exec main function& onclick=&exec_main()&&&/p&
execA.html
&!DOCTYPE HTML PUBLIC &-//W3C//DTD HTML 4.01 Transitional//EN& &http://www.w3.org/TR/html4/loose.dtd&&
&meta http-equiv=&content-type& content=&text/ charset=utf-8&&
&title& exec main function &/title&
&script type=&text/javascript&&
parent.parent.fMain(); // execute main function
execB.html
&!DOCTYPE HTML PUBLIC &-//W3C//DTD HTML 4.01 Transitional//EN& &http://www.w3.org/TR/html4/loose.dtd&&
&meta http-equiv=&content-type& content=&text/ charset=utf-8&&
&title& exec iframe function &/title&
&script type=&text/javascript&&
parent.window.myframe.fIframe(); // execute parent myframe fIframe function
执行如下图:
源码下载地址:
Tips:我已封装成类,文章地址
本文已收录于以下专栏:
相关文章推荐
iframe 父页面与子页面之间的方法的相互调用 
Blocked a frame with origin &http://127.0.0.1:8080& from accessing
main 与 iframe 相互通讯类
之前写过一篇《iframe与主框架跨域相互访问方法》,介绍了main与iframe相互通讯的原理,不了解原理的可以先看看。
今天把main与iframe相互...
一般情况下,js控制iframe的显示、调用很简单的,例如: window.frames[0].adduser(); 但在跨域的情况下却不能访问,js报出了一个没有权限的错误。例如:a.html(属于...
随着W3C一声令下,几年前使用非常频繁的frameset + frame已完成使命,光荣退伍。作为frameset的替代方案(姑且这么称吧),iframe的使用也多了起来。较frameset方案,if...
代码如下:
/*window.frames[]可以通过下标或名称访问单独的frame*/
window.onload=function(){
var h1=window.frames[&hea...
通过iframe实现跨域通信
iframe还是很强大的,不仅能实现同域通信,还可以跨域通信,甚至跨协议通信(如file/http),如果再结合jsonp,那就有很多种玩法了。不过有几条原则需...
解决方法:js所在页面的网站必须和iframe子页面所在wangz
他的最新文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)robot+selenium2library iframe中嵌套iframe的定位 - CSDN博客
robot+selenium2library iframe中嵌套iframe的定位
robot+selenium2library iframe中嵌套iframe的定位
web测试中,iframe的用法非常常用,且iframe中嵌套iframe也时常可见,经常会遇到定位不要元素的问题,以下就我的经验稍做介绍。
iframe定位
iframe中嵌套iframe定位
嵌套iframe中元素定位
iframe定位
iframe定位关键字
选择iframe
注:必须要定位到iframe才能定位iframe下的元素,一层iframe一般不会定位错误
unselect frame 释放iframe
注:必须释放iframe才能定位到iframe外的元素
iframe嵌套iframe定位
多层iframe嵌套定位需要一层一层的定位。
select frame
id=layui-layer-iframe4
click element
//*[@id="conftype_chosen"]/a
select frame
id=layui-layer-iframe1
click element
id=device-Tree_2_check
unselect frame
select frame
id=layui-layer-iframe4
click button
xpath=//*[@id="form1"]/div[2]/input[2]
unselect frame
查了很多资料说是iframe需要一层一层退出,但是我发现不可行,比如这里退出第二层iframe后,第一层的iframe中的元素仍然无法定位,需要我再次进入第一层iframe才能定位到第一层的元素,这里的定位是成功的,希望大神多多交流。
嵌套iframe中元素定位
嵌套iframe中元素定位与iframe外一致,这里想要说明的是有个小小的坑。
如上案例,进入第二层iframe后定位元素时,必须要sleep一会儿才行,不然无法定位到,即
unselect frame
希望大神多多指教。
本文已收录于以下专栏:
相关文章推荐
selenium2library期望值关键字总结
最近沉迷于selenium2library无法自拔,但是关键字太多,不能一一记下来,所以对期望值的关键字对做了一个整理,方便查看。
以下是我用robotframework + selenium2library做自动化测试遇到的一些问题,及解决方法。对于初学者
/os/921.html
    elenium2Library中原有的select_frame函数(对应的关键字为select f...
1.iFrame有ID 或者 name的情况
//进入id=”frame1”的frame中,定位id=”div1”的div和id=”input1”的输入框。
dr.switchTo().frame...
   
       
       
       
       
python selenium 定位iframe(多层框架)
很多人在用selenium定位页面元素的时候会遇到定位不到的问题,明明元素就在那儿,用firebug也可以看到,就是定位不到,这种情况很有可能是frame在搞鬼(原因之一,改天专门说说定位不到元素,可...
Robot Test Framework + Selenium2Library 是做基于网页自动化比较快捷的方案。
利用Selenium2Library里面提供的丰富的keywords,测试人员可以...
一个平常的页面的输入框,始终无法定位到该控件,查看源代码才知道用到了iframe, 于是使用Selet Frame关键字,但还是不行,查看了下Selet Frame的用法,它只支持id和name,可我...
进行页面元素操作,最麻烦的莫过于元素定位了,经常提示element is not visible 或者element is not exist
下面介绍常见的定位方法和定位中的问题
1 使用name...
他的最新文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)安全检查中...
请打开浏览器的javascript,然后刷新浏览器
< 浏览器安全检查中...
还剩 5 秒&robot&framework问题收集
以下是我用robotframework +
selenium2library做自动化测试遇到的一些问题,及解决方法。对于初学者应该有些帮助。
1 对于元素的外层包括frame/iframe标签的。一定要先select&
frame&name=xxx,然后再操作元素。
Select frame name=新建个案
click element &id= &xxxxx
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="/help/buildlang/ask/80.html" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="http://img.blog.csdn.net/45504?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWJjZHdoeQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
对于window.showModalDialog()模式打开的新窗口
Eg.点击“支付详情”的“详情”,出来一个新页面。如何定位呢?单纯的select window title=payDetail
page& 是定位不到新窗口的。解决办法如下:
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="/help/buildlang/ask/80.html" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="http://img.blog.csdn.net/18625?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWJjZHdoeQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="/help/buildlang/ask/80.html" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="http://img.blog.csdn.net/22975?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWJjZHdoeQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
第一句话取的Id就是要点击按钮的Id,已经实验过,网上的经验也说明,直接click
element id=xxx 是没有效果的。要用上面的第一句javascript执行点击按钮。&&
3 对于例子2 新打开的窗口没有title,用url不能定位到,如何解决呢? 比如:点击“充值退款”出现如图窗口。Select
window url=xxxx 根本定位不了。 &
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="http://img.blog.csdn.net/40166?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWJjZHdoeQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
网上有大神在selenium的源码里添加了几个关键字。这样我们就可以使用了。操作如下:
D:\Python27\Lib\site-packages\robotframework_selenium2library-1.1.0-py2.7.egg\Selenium2Library\locators&
(根据自身情况而定) 中的windowmanager.py 增加了方法 &
select_by_handle(self, browser, toHandle):
browser.switch_to_window(toHandle) &
get_window_handles(self, browser):
return [ window_info[0] for window_info in
self._get_window_infos(browser) ] &
get_current_window_handle(self, browser):
return browser.get_current_window_handle() &
D:\Python27\Lib\site-packages\robotframework_selenium2library-1.1.0-py2.7.egg\Selenium2Library\keywords
中的_browsermanagement.py 增加如下方法 &
select_window_by_handle(self, locator=None):
self._window_manager.select_by_handle(self._current_browser(),
locator) & &&
&&def get_window_handles(self):
"""Returns and logs handles of all windows known to the browser."""
self._log_list(self._window_manager.get_window_handles(self._current_browser()))
get_current_window_handle(self):
"""Returns and logs handle of current window known to the
browser."""
self._log_list(self._window_manager.get_current_window_handle(self._current_browser()))
==============================分割线==================================
按上述添加上,然后可以使用他新添加的关键字了。 &
网上大神只写了办法,没有说明他的关键字的使用方法。 我研究了下用法,实验成功。具体脚本如下。
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="http://img.blog.csdn.net/56874?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWJjZHdoeQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
@{b} get window handles //@{b}变量保存当前所有的窗口。@符号表示这个变量是集合。 Select
window by handle&
${b[1]}//这个是取变量b里面的第二个窗口。(下标从0开始)。 & 4 特殊下拉框的选择
& 对于这种下拉框,一拉啥没有。
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="/help/buildlang/ask/80.html" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="http://img.blog.csdn.net/10992?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWJjZHdoeQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
代码中也没有任何可操作的select
option标签等。如何是好。 既然下拉框,那就总可以选择。我们输入一个名“王XX”,下拉框自动出现这样。
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="/help/buildlang/ask/80.html" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="http://img.blog.csdn.net/36796?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWJjZHdoeQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
但是怎么选择上?代码实在没有相应的元素来操作啊。
不过,我们操作键盘,向下键,enter键,即可成功选择。
那问题就变成如何在robotframework+selenium2library中操作键盘。api给的很简单,press
key& xxxx。
查了向下键的ascii为40,enter键的为13.但是久经试验都不对。网上说可以考虑看下selenium的源码中向下键的标识用“\ue015”,好奇怪,我也不懂,就用了,果真对了。
相应脚本: &
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="http://img.blog.csdn.net/59865?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWJjZHdoeQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
有了键盘操作,一系列的特殊下拉框应该没有问题了。
对于一些不能用ascii码操作键盘的,可以查下selenium的源码,,看看源码里对某个键的表示到底是什么。
& & 5 对于页面弹个框
类似于网页弹出的这样的框。应该更准确的说,是alert(“”)弹出的对话框。
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="/help/buildlang/ask/80.html" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="http://img.blog.csdn.net/50226?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWJjZHdoeQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
两步即可:
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="/help/buildlang/ask/80.html" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
<img ALT="robotframework + selenium2library 一点测试的经验" src="/blog7style/images/common/sg_trans.gif" real_src ="http://img.blog.csdn.net/01473?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWJjZHdoeQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" DATA-BD-IMGSHARE-BINDED="1" STYLE="border: 1px solid rgb(204, 204, 204); padding: 3 max-width: 600"
TITLE="robot&framework问题收集" />
对于在jenkins上运行出现奇怪错误。
对于一些测试用例,明明本地和远程robotframework都跑的很顺畅,在jenkins上构建就一直出这样的错误:
WebDriverException: Message: u'unknown error: Element is not
clickable at point (69, 444). Other element would receive the
click: 这种鬼错误,很烦躁。 & 解决办法: Click&
element& xxx& 换成 execute
javascript& document.getElementByIdx_x('xxx').click()
基本换成javascript执行,都会轻松通过。如果元素没有ID的话,要用css定位的话,我用的jquery来执行。 Execute
javascript& $(“css”).click()。 & 7
对于上传下载的操作
网上有个AutoItLibrary,跟selenium2library类似,可以找下网上的安装方法,网上也有简单例子。本测试过程没有用到,不再详述。&
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。unit testing - Click element or Button on RobotFramework - Stack Overflow
Learn, Share, Build
Each month, over 50 million developers come to Stack Overflow to learn, share their knowledge, and build their careers.
Join the world’s largest developer community.
Display name
Email address
By registering, you agree to the
I have a problem to click an element/button using RobotFramework in a web page.
When I launch the script, an issue related to frame part is displayed.
I used the inspection code and I selected the element necessary to use the command 'Click element' or 'Click button'.
Here the code and the code where the element have to be clicked.
&iframe class="calculator-frame" frameborder="0" height="900px" id="lease-calculator" scrolling="no" src="/sites/default/files/web/calc/Leasing/html/lease.html?eng" style="overflow:" width="670px"&
&!DOCTYPE html&
&html ng-app="lease"&
&meta charset="utf-8"&
&title&Lease Calculator&/title&
&link rel="stylesheet" media="screen" href="../css/base.css" /&
&script src="../js/vendor/bowser.min.js"&&/script&
&script src="../js/vendor/underscore-min.js"&&/script&
&script src="../js/vendor/angular.min.js"&&/script&
&script src="../js/vendor/moment.min.js"&&/script&
&script src="../js/vendor/moment-range.js"&&/script&
&script src="../js/libs5.js"&&/script&
&script src="../js/calculator5.js"&&/script&
&body ng-controller="LeaseCtrl" ng-cloak&
&div class="container"
style="position:"&
&div class="row"&
&form id="leaseForm" name="leaseForm" class="form-horizontal" novalidate&
&div class="span6" style="margin-left: -4px"&&!--First Column--&
&label class="control-label"&
{{ 'type-of-lease' | i18n }}
&div class="control-group"&
&div class="controls controls-row"&
&label class="radio" style="font-weight:"&
&input id="operating" type="radio" ng-model="leaseType"
value="operating" ng-change="canExecute = false"/&
{{ 'operating-lease' | i18n }}
&label class="radio" style="font-weight:"&
&input id="financial" type="radio" ng-model="leaseType"
value="financial" ng-change="canExecute = false"/&
{{ 'financial-lease' | i18n }}
&div class="control-group"&
&label class="control-label" for="price"&
{{ 'property-price' | i18n }}
&div class="controls controls-row"&
&div class="input-append"&
&input id="price" name="price" ng-model="price.value" data-min="{{price.min}}"
ng-change="priceChange()" class="input-small" type="text" required float/&
&span class="add-on"&{{ currency }}&/span&
&p class="comment"&{{ 'enter-price-with-vat' | i18n }}&/p&
&span class="help-block error"
ng-show="leaseForm.price.$error.float ||leaseForm.price.$error.min || leaseForm.price.$error.required"&
{{ 'range-of' | i18n }} {{ price.min }}
&div class="control-group"&
&label class="control-label" for="contractFee"&
{{ 'contract-fee' | i18n }}
&div class="controls"&
&div class="input-append"&
&input id="contractFee" name="contractFee" ng-model="contractFee.value"
ng-change="contractFeeChanged()" class="input-small" type="text" required float/&
&span class="add-on"&{{ currency }}&/span&
&span id="contractFeeComment" class="comment nowrap"&{{ contractFeeEquivalent | number }} {{ alternativeCurrency }}&/span&
&span class="help-block error" id="contractFeeError" ng-model="showContractFeeError"
ng-show="showContractFeeError"&
{{ 'range-of' | i18n }} {{ contractFee.min |number }}
&span&&/span&
&div class="control-group"&
&label class="control-label" for="downpaymentType"&
&span ng-show="leaseType == 'operating'"&{{ 'downpayment' | i18n }}&/span&
&span ng-show="leaseType == 'financial'"&{{ 'first-payment' | i18n }}&/span&
&div class="controls controls-row"&
&input id="downpayment" name="downpayment" ng-model="downpayment.value"
data-min="{{downpayment.min}}" data-max="{{downpayment.max}}"ng-change="downpaymentChanged()"
class="input-mini" type="text" required integer/&
&select ng-model="downpaymentType" id="downpaymentType" class="input-tinny" ng-change="downpaymentTypeChanged()"&
&option value="%"&%&/option&
&option value="{{currency}}"&{{currency}}&/option&
&/select&&br /&
&span ng-show="downpaymentType == '%'" id="downpaymentComment" class="comment"&
{{ downpaymentMoney | number }} {{ currency }}
&span class="help-block error"
ng-show="((leaseForm.downpayment.$error.min || leaseForm.downpayment.$error.max) && downpaymentType == '%') ||
leaseForm.downpayment.$error.required || leaseForm.downpayment.$error.integer"&
{{ 'range-of' | i18n }} {{ downpayment.min }} {{ 'range-to' | i18n }} {{ downpayment.max }}
&div class="control-group"&
&label class="control-label" for="contractPeriod"&
{{ 'contract-period' | i18n }}
&div class="controls"&
&select ng-model="contractPeriod" ng-options="period for period in periods"
class="input-mini" id="contractPeriod"&
&div id="financialCol1" ng-show="leaseType == 'financial'"&
&div class="control-group"&
&label class="control-label" for="propertyType"&
{{ 'property-type' | i18n }}
&div class="controls"&
&select ng-model="propertyType" ng-change="propertyTypeChanged()"
class="input-choose" id="propertyType" ng-required="leaseType == 'financial'"&
&option value=""&{{ 'choose-one' | i18n }}&/option&
&option value="new"&{{ 'new' | i18n }}&/option&
&option value="used"&{{ 'used' | i18n }}&/option&
&/div&&!-- /div .span6 First Column--&
&div class="span"&&!--Middle Column--&
&div class="column-separator"&&/div&
&div class="span6"&&!--Second Column --&
&div id="operatingCol2a" ng-show="leaseType == 'operating'"&
&div class="control-group"&
&label class="control-label"&
{{ 'set-downpayment' | i18n }}
&div class="controls controls-row"&
&label class="radio" style="font-weight:"&
&input type="radio" id="setDownpaymentYes" ng-change="setDownpayment = 'true'"
ng-model="setDownpayment" value="true"/&
{{ 'yes' | i18n }}
&label class="radio" style="font-weight:"&
&input type="radio" id="setDownpaymentNo" ng-change="setDownpayment = 'false'"
ng-model="setDownpayment" value="false"/&
{{ 'no' | i18n }}
&div id="financialCol2a" ng-show="leaseType == 'financial'"&
&div class="control-group"&
&label class="control-label" for="propertyYear"&
{{ 'year' | i18n }}
&div class="controls"&
&select ng-model="propertyYear" ng-disabled="propertyType == '' || propertyType == 'new'"
ng-options="year for year in yearsList" class="input-choose" id="propertyYear" ng-required="leaseType == 'financial'"&
&option value=""&{{ 'choose-one' | i18n }}&/option&
&div class="control-group"&
&label class="control-label" for="carCategory"&
{{ 'car-category' | i18n }}
&div class="controls"&
&select ng-model="carCategory" ng-change="modelsForBrand()"
ng-disabled="propertyYear == ''" id="carCategory" class="input-normal" ng-required="leaseType == 'financial'"&
&option value=""&{{ 'choose-one' | i18n }}&/option&
&option value="passenger"&{{ 'passenger-car' | i18n }}&/option&
&option value="truck"&{{ 'truck-car' | i18n }}&/option&
&div class="control-group"&
&label class="control-label" for="carBrand"&
{{ 'car-brand' | i18n }}
&div class="controls"&
&select id="carBrand" name="carBrand" ng-model="carBrand" ng-change="modelsForBrand()" ng-disabled="carCategory == ''"
ng-options="brand for brand in carBrands" class="input-normal" ng-required="leaseType == 'financial'"&
&option value=""&{{ 'choose-one' | i18n }}&/option&
&div class="control-group"&
&label class="control-label" for="carModel"&
{{ 'car-model' | i18n }}
&div class="controls"&
&select ng-model="carModel" ng-options="model for model in carModels"
class="input-normal" id="carModel" ng-disabled="carBrand == ''" ng-required="leaseType == 'financial'"&
&option value=""&{{ 'choose-one' | i18n }}&/option&
&div class="control-group"&
&label class="control-label" for="interestRate"&
{{ 'interest-rate' | i18n }}
&div class="controls controls-row"&
&div class="input-append"&
&input id="interestRate" name="interestRate" ng-model="interestRate.value" data-min="{{interestRate.min}}"
data-max="{{interestRate.max}}" class="input-small" type="text" required float/&
&span class="add-on"&%&/span&
&span class="help-block error"
ng-show="leaseForm.interestRate.$error.min || leaseForm.interestRate.$error.max ||
leaseForm.interestRate.$error.required || leaseForm.interestRate.$error.float"&
{{ 'incorrect-interest-rate' | i18n }}
&div id="operatingCol2b" ng-show="leaseType == 'operating'"&
&div class="control-group"&
&label class="control-label" for="residualValue"&
{{ 'residual-value' | i18n }}
&div class="controls controls-row"&
&input id="residualValue" name="residualValue" ng-model="residualValue.value"
data-min="{{residualValue.min}}" data-max="{{residualValue.max}}"
ng-required="leaseType == 'operating'" class="input-mini" type="text" required float/&
&select ng-model="residualValueType"
ng-change="residualValueTypeChanged()" class="input-tinny"&
&option&%&/option&
&option&{{currency}}&/option&
&span class="help-block"
ng-show="leaseForm.residualValue.$error.float || leaseForm.residualValue.$error.min ||
leaseForm.residualValue.$error.max || leaseForm.residualValue.$error.required"&
&span class="error"&{{ 'range-of' | i18n }} {{
residualValue.min }}&/span&
&span class="error" ng-show="residualValueType == '%'"&{{ 'range-to' | i18n }} {{ residualValue.max }}&/span&
&div class="control-group"&
&label class="control-label" for="monthlyPayment-operating"&
{{ 'monthly-payment' | i18n }}
&div class="controls controls-row"&
&label id="monthlyPayment-operating" class="highlight-green"&
{{ operatingMonthlyPayment | number }} {{ currency }}
&div id="financialCol2b" ng-show="leaseType == 'financial'"&
&div class="control-group"&
&label class="control-label" for="monthlyPayment-financial"&
{{ 'monthly-payment' | i18n }}
&div class="controls controls-row"&
&label id="monthlyPayment-financial"
class="highlight-green"&
{{ financialMonthlyPayment | number }} {{ currency }}
&div class="control-group"&
&label class="control-label" for="aprHighlight"&
{{ 'apr' | i18n }}
&div class="controls controls-row"&
&label id="aprHighlight" class="highlight-green"&
{{ financialAPR | number }}%
&div class="control-group pull-right"&
&div class="controls"&
&a class="button big" id="getSchedule" ng-click="getSchedule(leaseType)"&
&span&{{ 'calculate' | i18n }}&/span&
&/div&&!-- /div .span6 Second Column--&
&/form&&!-- /form .form-horizontal --&
&/div&&!-- /div .row --&
&/div&&!-- /div .container --&
&div class="container" style="position:"&
&div class="row"&
&div id="alertError" class="msg-error" ng-show="showErrorMessage"&
{{ 'msg-unable-to-issue-lease' | i18n }}
&div class="span12"&
&p ng-bind-html-unsafe="'lease-calculator-msg' | i18n"&&/p&
&p ng-show="leaseType == 'financial'"&{{ 'lease-calculator-insurance-msg' | i18n }}&/p&
&div id="tables" class="span12" ng-show="canExecute && leaseType != 'operating'"&
&div class="hr-thick"&&hr /&&/div&
&h3&{{ 'payment-schedule' | i18n }}&/h3&
&div id="table-operating" ng-show="leaseType == 'operating'"&
&table class="table table-condensed table-hover table-striped"&
&th style="width: 10%"&{{ 'month-no' | i18n }}&/th&
&th style="width: 30%;"&{{ 'uncovered-outstanding-value' | i18n }} ({{ currency }})&/th&
&th style="width: 15%;"&{{ 'rent' | i18n }} ({{ currency }})&/th&
&th style="width: 15%;"&{{ 'total' | i18n }} ({{ currency }})&/th&
&th style="width: 15%;"&{{ 'collateral-type' | i18n }} ({{ currency }})&/th&
&th style="width: 15%;"&{{ 'collateral' | i18n }} ({{ currency }})&/th&
&tr ng-repeat="payment in operatingSchedule"&
&td&{{ operatingSchedule[$index].no }}&/td&
&td&{{ operatingSchedule[$index].leftToPay }}&/td&
&td&{{ operatingSchedule[$index].rent
&td&{{ operatingSchedule[$index].total }}&/td&
&td&{{ operatingSchedule[$index].downpaymentInclusion }}&/td&
&td&{{ operatingSchedule[$index].downpayment }}&/td&
&tr style="font-weight:"&
&td class="input-mini"&{{ 'total' | i18n }}&/td&
&td&{{ operatingTotal.rent }}&/td&
&td&{{ operatingTotal.total }}&/td&
&td&{{ operatingTotal.downpaymentInclusion }}&/td&
&/div&&!-- /div #table-operating --&
&div id="table-financial" ng-show="leaseType == 'financial'"&
&table class="table table-condensed table-hover table-striped"&
&th style="width: 10%"&{{ 'month-no' | i18n }}&/th&
&th&{{ 'uncovered-outstanding-value' | i18n }} ({{ currency }})&/th&
&th&{{ 'value-coverage-amount' | i18n }} ({{ currency }})&/th&
&th&{{ 'interest-rate' | i18n }} ({{ currency }})&/th&
&th&{{ 'total' | i18n }} ({{ currency }})&/th&
&th&If P&C Insurance AS ({{ currency }})&/th&
&th&AB &#8222;Lietuvos draudimas&#8221; ({{ currency }})&/th&
&th&&#8222;PZU Lietuva&#8221; ({{ currency }})&/th&
&tr ng-repeat="payment in financialSchedule"&
&td&{{ financialSchedule[$index].no }}&/td&
&td&{{ financialSchedule[$index].leftToPay
&td&{{ financialSchedule[$index].downpayment }}&/td&
&td&{{ financialSchedule[$index].interest }}&/td&
&td&{{ financialSchedule[$index].total }}&/td&
&td&{{ insurance.IF.schedule[$index] || '-' }}&/td&
&td&{{ insurance.LD.schedule[$index] || '-' }}&/td&
&td&{{ insurance.PZU.schedule[$index] || '-' }}&/td&
&tr style="font-weight:"&
&td class="input-mini"&{{ 'total' | i18n }}&/td&
&td&{{ financialTotal.downpayment }}&/td&
&td&{{ financialTotal.interest }}&/td&
&td&{{ financialTotal.total }}&/td&
&td&{{ insurance.IF.total }}&/td&
&td&{{ insurance.LD.total
&td&{{ insurance.PZU.total }}&/td&
&/div&&!-- /div #table-financial --&
&/div&&!-- /div #tables --&
&/div&&!-- /div .row --&
&/div&&!-- /div .container --&
&script type="text/javascript"&BrowserDetect.checkSupport();&/script&
The part that I am interested to execute is this:
&div class="control-group pull-right"&
&div class="controls"&
&a class="button big" id="getSchedule" ng-click="getSchedule(leaseType)"&
&span&{{ 'calculate' | i18n }}&/span&
I used this:
User fill in the fields
[Documentation]
The user can fill in all fields
OPEN BROWSER
https://www.seb.lt/eng/private/calculator-leasing
wait until page contains
Calculator of leasing
select frame
input text
click element
${calculate}
CLOSE BROWSER
I hope that I gave all information so that I can solve my issue.
Try this code in firefox browser.
*** Settings ***
Selenium2Library
*** Variables ***
https://www.seb.lt/eng/private/calculator-leasing
${BROWSER}
*** Test Cases ***
User fill in the fields
[Documentation]
The user can fill in all fields
OPEN BROWSER
${BROWSER}
Maximize Browser Window
wait until page contains
Calculator of leasing
Wait Until Element Is Visible
css=iframe[id="lease-calculator"]
Select Frame
css=iframe[id="lease-calculator"]
Wait Until Element Is Visible
css=input[id="price"]
input text
css=input[id="price"]
Wait Until Element Is Visible
css=a[id="getSchedule"]
Click Element
css=a[id="getSchedule"]
It works for me.
use geckodriver 17 for firefox.
In chrome browser may b you get some cookies related pop up than you need to close that in your script. but for firefox it works fine.
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you&#39;re looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled

我要回帖

更多关于 iframe和frame的区别 的文章

 

随机推荐