开发者

Can not click <button> element using javascript onmousedown with Watir

Using Watir I have been able to isolate this button element:

<BUTTON id=authButton class=commandButton onmousedown="$('newOrder:hiddenAuth').click();">Authorize Payment</BUTTON>

Here is my watir code:

$browser.div(:id, "rSide:j_id750_body").table(:index, 0) [1] [0] .button(:index, 0).click

I was able to see I'm on the <button> by using watir's "flash" 开发者_JS百科method to highlight the button. For some reason I am unable to actually click the button. I think it might have something to do with the onmousedown code but I really don't know. Any help would be greatly appreciated.


The button is wired up to do some specific action when it see's the onmousedown event, so if .click is not working, the next thing to try is firing that specific event, instead of using the .click method.

If that doesn't work try forcing the javascript to execute the newOrderLhiddenAuth script.

oh and FYI for your developer, they may want to get into the habit of using lower case for their HTML tags

"the World Wide Web Consortium (W3C) recommends lowercase in HTML 4, and demands lowercase tags in XHTML."

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜