admin管理员组文章数量:1314514
I am new to selenium.
My application is only IE patible.
I know that we can run test cases in any any browsers using respective drivers but is there any way that we can use to record test case using selenium IDE in Internet Explorer ??
I am new to selenium.
My application is only IE patible.
I know that we can run test cases in any any browsers using respective drivers but is there any way that we can use to record test case using selenium IDE in Internet Explorer ??
Share Improve this question asked Aug 18, 2014 at 0:48 user3834140user3834140 511 gold badge3 silver badges6 bronze badges 2- Why, in 2014, is someone writing to be JUST IE patible? – Jeremy J Starcher Commented Aug 18, 2014 at 2:55
- 2 @JeremyJStarcher Some customers only use a single browser/platform and therefore there is no need to test on any other bination. – CynicalBiker Commented Aug 18, 2014 at 13:08
3 Answers
Reset to default 7We have implemented our own Recorder which will be used only for recording in Internet Explorer. It is a javascript file.
The concept is to add listeners to each object in the source code of the GUI of web page. Below code helps you to do that. As soon as the page is loaded these listeners will be added. When you perform click action, all its properties will be captured.
Here i have given an example of adding listener and getting properties of the object of type "SELECT", you can do the same thing for other types of objects.
var added_MClistener = false;
var tagn = dObj.tagName;
if(tagn == "SELECT")
{
dObj.attachEvent("onchange",so_showObjInfo);
dObj.added_OClistener = true;
dObj.so_prevBGColor = alll[i].style.backgroundColor;
}
if(tagn != "OPTION" && tagn != "SELECT" )
{
dObj.added_MClistener = true;
dObj.attachEvent("onclick",so_showObjInfo);
dObj.so_prevBGColor = alll[i].style.backgroundColor;
}
function so_showObjInfo(e) {
if(pause)return;
if(isActive)return;
var preE = e;
var e =e? e:window.event;
var ele=e.target?e.target:e.srcElement;
activeObj = ele;
var eltagn= activeObj.tagName;
var currentNode=activeObj;
var path=[];
while(currentNode){var pe=getNode(currentNode);if(pe){path.push(pe);if(pe.indexOf('@id')!=-1)break;}currentNode=currentNode.parentNode;}var xpath="//"+path.reverse().join('/');
var fff=0;
var xpath;
while(currentNode){var pe=getNode(currentNode);if(pe){path.push(pe);if(pe.indexOf('@id')!=-1){fff=1; break;}if(pe.indexOf('@name')!=-1){fff=1; break;}}currentNode=currentNode.parentNode;}if(fff==1){xpath="//"+path.reverse().join('/');}
var acurrentNode=activeObj;
var apath=[];
while(acurrentNode){var ape=agetNode(acurrentNode);if(ape){apath.push(ape);}acurrentNode=acurrentNode.parentNode;} var axpath="//"+apath.reverse().join('/');
var el=activeObj;
var cssPath = cssselect(el);
if (cssPath!=null)
{
cssPath="css="+cssPath;
}
var objval=activeObj.value;
var objname=activeObj.name;
var objidd=activeObj.id;
}
In this way we can add listeners to the objects on the webpage and get their properties. Now its up to you what to do next. You can either write it in an excel like we did(in a particular format) or you can create a notepad file.
Hope it helps....
Selenium IDE is only available on Firefox. There is noway to record your test on IE using Selenium IDE.
Recorder is for Firefox. Record with Firefox replay on ie. Tweak script as needed
本文标签: javahow to record testcase using selenium in IEStack Overflow
版权声明:本文标题:java - how to record testcase using selenium in IE - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741961550a2407308.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论