- -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=y
Saturday, November 15, 2008
Thursday, November 6, 2008
To modify the DOM of a webpage @runtime with Ruby & Watir you can execute JavaScript like so:
- spoofValue = 'bogus'
- @ie = Watir::IE.new
- @ie.goto('http://www.ruby.org/')
- ieWindow = @ie.document.parentWindow
- ieWindow.execScript("var newOption = document.createElement('option')")
- ieWindow.execScript("newOption.text = 'Spoofed'")
- ieWindow.execScript("newOption.value = '" + spoofValue + "'")
- ieWindow.execScript("var selectControl = document.getElementById('666')")
- ieWindow.execScript("selectControl.add(newOption)")
and then you can select the new bogus option like so:
- @ie.select_list(:id, '666').select_value(spoofValue )
Subscribe to:
Posts (Atom)