find a control which is not defined in CUITe_BrowserWindow class

Sep 21, 2012 at 1:56 AM

Can CUITe find a control that is not defined in the CUITe_BrowserWindow class.

I did like this but it displays an error: Object reference not set to an instance of an object.

CUITe_HtmlButton btn = new CUITe_HtmlButton();
btn.SetSearchProperty("value", "Logon");
Thank you so much.

Sep 21, 2012 at 2:19 AM

I am not exactly sure what you are trying to do.

You can attach to an existing browser process by calling the CUITe_BrowserWindow.FromProcess() method and then find the control.

For example,

BrowserWindow bWin = CUITe_BrowserWindow.FromProcess(Process.GetProcessesByName("iexplore").Single(x => !string.IsNullOrEmpty(x.MainWindowTitle)));

CUITe_HtmlButton btnlogon = bWin.Get<CUITe_HtmlButton>("value=Logon");


Sep 21, 2012 at 3:47 AM

When I did like you said, it has an error: 'System.Array' does not contain a definition for 'Single'

Sep 21, 2012 at 4:24 AM

You will have to add a using statement for System.Linq at the top of the source code file;

using System.Linq;

Sep 21, 2012 at 4:34 AM

Have an error at the line:

CUITe_HtmlButton btnlogon = bWin.Get<CUITe_HtmlButton>("value=Logon");

It is said that BrowserWindow does not contain a definition for Get. So does it mean that I need to create a class BrowserWindow and declare the method Get in that class?

Thank you so much.

Sep 21, 2012 at 6:10 AM
Edited Sep 21, 2012 at 6:25 AM

Sorry, the code should have been:

CUITe_BrowserWindow bWin = new CUITe_BrowserWindow("my browser title");