admin管理员组文章数量:1433505
I'm writing automated UI tests in C# using Selenium 2 Web Driver for web application written in ASP.NET and MS AJAX. I would like to "inject" custom JS code on the beginning of test which will execute every time async postback is finished. Example code below
function EndRequestHandler(sender, args)
{
DoSomeStuff(...);
}
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
The question is how to do this using Selenium (I don't want to modify original application). This have to be patible with IE, Firefox and Chrome drivers, so using custom profiles for Firefox is not an option (although I might be missing something here)
I'm writing automated UI tests in C# using Selenium 2 Web Driver for web application written in ASP.NET and MS AJAX. I would like to "inject" custom JS code on the beginning of test which will execute every time async postback is finished. Example code below
function EndRequestHandler(sender, args)
{
DoSomeStuff(...);
}
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
The question is how to do this using Selenium (I don't want to modify original application). This have to be patible with IE, Firefox and Chrome drivers, so using custom profiles for Firefox is not an option (although I might be missing something here)
Share Improve this question asked Apr 1, 2012 at 17:51 MidiMidi 4791 gold badge5 silver badges20 bronze badges2 Answers
Reset to default 3I might misunderstand what you're trying to do here, but here is a link that might illustrate what you need. Execute JavaScript using Selenium WebDriver in C#
If you just need to wait until all the ajax pletes before continuing your Selenium test this article will help:
How to get selenium to wait for ajax response?
本文标签: cInjecting custom JS Code using Selenium Web DriverStack Overflow
版权声明:本文标题:c# - Injecting custom JS Code using Selenium Web Driver - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745613389a2666250.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论