Hey Jarmo,
thank you for your help. ive written some Javascript:
var option = document.createElement("option")
option.setAttribute("value", "/content/story/jackpotjoy/video_test99")
var text = document.createTextNode("/content/story/jackpotjoy/
video_test99")
option.appendChild(text)
var option_location = document.evaluate(
"//d...@id= 'list']//sele...@id= 'allItems']//option[7]",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
option_location.snapshotItem(0).appendChild(option);
now when you write:
browser.excute_script("js code")
do you mean it should look something like this:
browser.excute_script("var option = document.createElement("option")
option.setAttribute("value", "/content/story/jackpotjoy/video_test99")
var text = document.createTextNode("/content/story/jackpotjoy/
video_test99")
option.appendChild(text)
var option_location = document.evaluate(
"//d...@id= 'list']//sele...@id= 'allItems']//option[7]",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
option_location.snapshotItem(0).appendChild(option);")
OR
browser.execute_script("JS_File_Name")
kind regards,
Usman Hussain
On Sep 25, 9:42 am, Jarmo Pertman <[email protected]> wrote:
> Yup, you could do that with JavaScript. If you have jQuery or
> Prototype in use on the page, even better. Otherwise you'd have to use
> pure JavaScript.
>
> Do it like this:
> browser.execute_script("js code")
>
> Google for DOM manipulation in JavaScript since that is not specific
> issue of Watir.
>
> Jarmo Pertman
> -----
> IT does really matter -http://www.itreallymatters.net
>
> On Sep 24, 3:32 pm, Usman Hussain <[email protected]> wrote:
>
>
>
> > The reason is... from a screen a pop up is fired. and from this pop up
> > i am unable to hit the ok button...
> > Ive put all the information down in a previous
> > posthttp://groups.google.com/group/watir-general/browse_thread/thread/d99...
> > but was unable to get any help...
> > so the only other way to manipulate what this pop up will do is to
> > change the html in the first screen to add the option that would have
> > been selected in the pop up?
>
> > in my previous post ive tried using autoit to click on the button but
> > to no avail...
>
> > any help would be much appreciated.
>
> > kind regards,
> > usman hussain
>
> > On Sep 24, 12:26 pm, Željko Filipin <[email protected]>
> > wrote:
>
> > > On Fri, Sep 24, 2010 at 1:19 PM, Usman Hussain <[email protected]>
> > > wrote:
>
> > > > Is the anyway using Watir-Webdriver where I can edit or add to the
> > > > HTML on a page in my test.
>
> > > Why would you do that? I do not even see any difference in two provided
> > > HTMLs.
>
> > > Watir is tool for driving browsers, it usually can not do something you
> > > could not do manually (and this looks like it could not be done manually).
>
> > > There is probably a way to do this by executing some javascript.
>
> > > Željko
> > > --
> > > watir.com - community manager
> > > watirpodcast.com - host
> > > testingpodcast.com - audio podcasts on software testing. all of them
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]