watin - Cannot convert lambda expression to type 'string' because it is not a delegate type -
w => w.classname == "button" && new winbutton(w.hwnd).title == "ok"
i using class clicks 'ok' on dialog windows opens while testing website on watin. line gives error of lambda expression cannot converted type string because not delegate type.
i have used using system.linq , still not work
please me out!
the whole code follows:
using system; using system.text; using system.collections.generic; using system.linq; using microsoft.visualstudio.testtools.unittesting; using watin.core; using sco.automated.testing.service; using watin.core.dialoghandlers; using watin.core.native.windows; using watin.core.native.internetexplorer; namespace sco.automated.testing.service { public class okdialoghandler : basedialoghandler { public override bool handledialog(window window) { var button = getokbutton(window); if (button != null) { button.click(); return true; } else { return false; } } public override bool canhandledialog(window window) { return getokbutton(window) != null; } private winbutton getokbutton(window window) { var windowbutton = new windowsenumerator().getchildwindows(window.hwnd, w => w.classname == "button" && new winbutton(w.hwnd).title == "ok").firstordefault(); if (windowbutton == null) return null; else return new winbutton(windowbutton.hwnd); } } }
given the code here, looks fine me.
is possible you're using older version of watin doesn't have overload? if in windowsenumerator
in reflector, see overload?
public ilist<window> getchildwindows(intptr hwnd, windowenumconstraint constraint)
Comments
Post a Comment