hi I want to gain the control of last opened browser.How would I do that? For an example b=browser.windows.last this is returning the window object but I want IE object thereby I could able to access function inside WATIR::Browser, So how would I do this?
on 2013-11-06 11:26
on 2013-11-06 12:03
Try b = browser.windows.last.browser
on 2013-11-06 12:40
hi It's working perfect, thank you.
on 2013-11-07 06:46
hi Joel Pearson, 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?
on 2013-11-07 09:57
Wait for the page to load before line 1
on 2013-11-07 10:02
yes that's what I am putting sleep statement in between, but are you saying someother way?
on 2013-11-07 10:16
Depending on your version of Watir, this might work: $browser.link(:id,'something').when_present.click
on 2013-11-07 15:14
hi thank you. when_present is working here, But I wrongly typed the code, Actually it was, line 1:$browser1 = $browser.windows.last.browser line 2: parseHTML($browser1.table(:class,'something').html)
on 2013-11-07 15:40
on 2013-11-08 08:15
hi Thank you. I use your code but still it's not reading. It's ok, I swifted to attach browser using index now.