开发者

Getting position of item in Watir, using either AutoITX3.Control or pure Watir

I use Watir with IE. On a website, there is a link that, for some reason, it does not work with Watir. The Watir line below causes the screen to flash, while it should downloa开发者_如何学God a CSV file.

browser.frame(:id, "ptifrmtgtframe" ).link( :id => 'URL$1' ).click

To replace this command, I used the following AutoIt script, that works:

#include <IE.au3>
$oIE = _IEAttach ("Process Monitor")
$oIE = _IEFrameGetCollection ($oIE, 0)
$oLink = _IEGetObjById( $oIE, "URL$1" )
$x = _IEPropertyGet($oLink, "screenx")
$y = _IEPropertyGet($oLink, "screeny")
MouseMove( $x + 100, $y + 5 ) 
MouseClick( "left" )

Now, I would like to convert this AutoIt script into Watir. The biggest problem is, I cannot get the X and Y of the link. Can you help?

I also checked this example but I get the error message:

I:/watir/abs_pos.rb:47:in '<module:WindowsInput>': uninitialized constant WindowsInput::Win32API (NameError) from I:/watir/abs_pos.rb:46:in '<main>'

I also added require 'win32ole' but it did not help.

I use Win 7 x64, IE 8.


My guess would be that you have to fire a JavaScript event: How to find out which JavaScript events fired?.

And, as Dave said, show us the HTML, or provide a link to the page, if it is public.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜