This project is read-only.

find a control which is not defined in CUITe_BrowserWindow class

Sep 21, 2012 at 2: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");
btn.Click();
Thank you so much.

Sep 21, 2012 at 3: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");

btnlogon.Click();

Sep 21, 2012 at 4: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 5: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 5: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 7:10 AM
Edited Sep 21, 2012 at 7:25 AM

Sorry, the code should have been:

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