Hi all,
I want to create record and play back program in java for webdriver instance.. We can achieve it through java script...
Now the question is how to interact with the java script listeners through webdriver code. Any ideas appreciated..
Thanks and Regards,
Suneel Kumar Oleti..
Hi Xiang,
I have developed a extension which has js and gonna start my driver with that extension loaded. Now trying to talk to the js script which is loaded.
Is there a better approach than this??
Regards,
Suneel
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/BLU174-W462188F7363092A952A97290C60%40phx.gbl.
Hi,
I'm going for the worst case scenario where I want to store the actions in a JS string and retrieve it periodically.. But not able to do that, my Webdriver code is not waiting for the return of the JS.. It is simply going ahead.
Any way, where I can achieve it??
Regards,
Suneel
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/BLU174-W234066814A166595E29C9D90C60%40phx.gbl.
Hi,
Yeah I agree with that.. But I have implicit wait in my JS before returning value. It is working fine when I run it individually, where as with webdriver it is exiting immediately..
Regards,
Suneel
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/BLU174-W290127BE0707F04861304C90C70%40phx.gbl.
Hi,
Below I'm adding the JS code which I used :
var flag = 0;
var elementId;
window.addEventListener("click", function(e){
elementTagName=e.target.id;
alert(elementTagName);
flag++;});
var timer = setInterval(function(){myTimer()},1000);
function myTimer() {
if(flag==0){
document.getElementById("demo").innerHTML=flag;
}else {
clearInterval(timer);
return elementId; //Returning the element ID which was clicked
}
}
Regrets for the format, I'm sending it from mobile..
Regards,
Suneel.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/BLU174-W486A46B31A56664A8EAA2690C70%40phx.gbl.
window.addEventListener("click", function(e){
var elementId=e.target.id;
recordAction = "action=click;elementId="+elementId;
}
);
on your java side
call js "return recordAction;" periodically.
I didn't understand the meaning of your timer. you can't let a js timer work with your java codes because there are separate.
Best Regards,
--david
Hi David ,
Thanks a lot. I did little research also on this. I need a better approach rather than periodically calling this. Can we store all the actions in file or something else and read it at once through our java program??
Which would be little efficient.
But the main problem is browser side script has limitations for writing in local file.
Any other way which we can achieve it? Like store in some temp file and read that file.
Regards,
Suneel
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/BLU174-W33311FCA7C390163C8E83290C40%40phx.gbl.