hello,
I have this button element which i can recognize only through his xptah

FORM[1]/TABLE[1]/TBODY[1]/TR[1]/TD[2]/TABLE[5]/TBODY[1]/TR[1]/TD[1]/A[1]/IMG[1]

how can preform a click runing a java script

Thanks
Kobi

Do you use some kind of javascript library (e.g. prototype, jquery)?
If you use prototype, then you can click that button by something like this

var selector = new Selector('form > table:nth-child(1) > tbody > tr:nth-child(1) >td:nth-child(2) > table:nth-child(5) > tbody > tr:nth-child(1) > td:nth-child(1) > a:nth-child(1) > img:nth-child(1)');
var elements = selector#findElements(document.body);
elements[0].click();

Result should be array, so you need a first element of it.

If you are asking about Javascript, then add "onclick='A_JAVA_SCRIPT_FUNCTION()'" to the tag that you want it to perform a javascript script. If you are asking for "java" script, you are on the wrong forum.

In this case, I assume that the HTML element you need to add 'onclick' event is "img." So you should do is...

<img src="whatever" onclick="a_javascript_function(argument1, ...)">

I can't give you any more code because there is no more info from your post.

Do you use some kind of javascript library (e.g. prototype, jquery)?
If you use prototype, then you can click that button by something like this

var selector = new Selector('form > table:nth-child(1) > tbody > tr:nth-child(1) >td:nth-child(2) > table:nth-child(5) > tbody > tr:nth-child(1) > td:nth-child(1) > a:nth-child(1) > img:nth-child(1)');
var elements = selector#findElements(document.body);
elements[0].click();

Result should be array, so you need a first element of it.

No im not usin any kind of special library
any other sugestion?

Oh, I misunderstood what you said earlier... You are using Xpath to access the node. I have never used Xpath before and I am not sure how to modify node's attributes. From my quick search, function 'fn:replace(string,pattern,replace)' may be what you are looking for? Something like...

FORM[1]/TABLE[1]/TBODY[1]/TR[1]/TD[2]/TABLE[5]/TBODY[1]/TR[1]/TD[1]/A[1]/IMG[1][replace(@onclick,/.*/, "jsscript_function()")]

Just a guess though...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.