I was using WATIR::IE.attach(:index,1) to attach the browser. Now I am
using $browser1 = $browser.windows.last.browser and the problem
with this type of attachment is, before the browser is completely
loaded, next operation is performed, For an example,
line 1:$browser1 = $browser.windows.last.browser
line 2:$browser.link(:id,'something').click
Line number 2 is executed before the page loads completely. So it gives
the error of unable to locate the element, Now If use sleep statement in
between line1 and line 2 like below
line 1:$browser1 = $browser.windows.last.browser
sleep 2
line 2:$browser.link(:id,'something').click
it works, But it's not an ideal solution because browser loading time
varies. The same problem did not occur while I was using
WATIR::IE.attach(:index,1). So could you please tell me how to overcome
this problem?