开发者

Using WatiN with a rad menu item cannot find sub link most of the time

My test needs to click a link from a rad tools menu that it can only find some of the time. Even when it finds the link ByText it cannot double click it. If I hover the menu item it will always find it. Cannot find a hover in Watin, otherwise I've tried refresh, sleeps, focus, keypress, WaitUntilExists, double clicks, etc. Its using a class rmText from rad tools.

The only thing I've found to work is hovering that drop down while the tests are running... Wish I could just do that for a few seconds...

//process would be a menu item below the radtool menu item that only shows up when certain conditions exist (but always does with the hover)

if (ie.Link(Find.ByText("process")).Exists) //开发者_如何学Pythonsometimes I get through here ie.Link(Find.ByText("process")).Click(); // this works only if I hover


Might be that creating the menu item is taking some time. Calling Exists does check if it exists now, maybe if you wait a few (milli)seconds it will be there. Try calling

ie.Link(Find.ByText("process")).WaitUntilExists()

This will time out if the element never appears, otherwise you can savely call the click.

BTW maybe you can get rid of the exists check, WatiN does call WaitUntilExists by itself too before calling Click().

HTH, Jeroen

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜