WATIR javascript alert 창 처리하는 법
ruby 소스
HTML
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script type="text/javascript">
function test(){
alert('test');
}
</script>
</HEAD>
<BODY>
<form>
<input type="button" id="btnAlert" value="clickMe" OnClick="test();" />
</form>
</BODY>
</HTML>
# test.rb
require 'watir'
include Watir
test_site = 'http://localhost/test.html'
ie = IE.new
ie.goto(test_site)
Thread.new { system("rubyw \"jscriptExtraAlert.rb\"") }
ie.button(:id, 'btnAlert').click
ie.close
require 'watir'
include Watir
test_site = 'http://localhost/test.html'
ie = IE.new
ie.goto(test_site)
Thread.new { system("rubyw \"jscriptExtraAlert.rb\"") }
ie.button(:id, 'btnAlert').click
ie.close
# jscriptExtraAlert.rb
require 'watir/WindowHelper'
helper = WindowHelper.new
helper.push_alert_button()
require 'watir/WindowHelper'
helper = WindowHelper.new
helper.push_alert_button()
HTML
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script type="text/javascript">
function test(){
alert('test');
}
</script>
</HEAD>
<BODY>
<form>
<input type="button" id="btnAlert" value="clickMe" OnClick="test();" />
</form>
</BODY>
</HTML>
Trackback Address:이 글에는 트랙백을 보낼 수 없습니다