Web Controls and API

The following API waits until the requested element satisfies a condition, or a timeout is reached:

bool WaitFor(Func<UIElementBase, bool> predicate, TimeSpan timeout)

predicate: The condition that the element should meet (in lambda expression or delegate)

timeout: The timeout period, in the provided timespan

return value: true if condition was satisfied; false if the timeout was reached

For example:

if (IExploreApp.WaitFor(delegate { return IExploreApp.searchConditionWebEditBox.Exists; }, TimeSpan.fromSeconds(5)))

{

………………..

}

The following sections list and describe web controls and binding attribute names for different types of web controls.

tog_minusEdit Class Control

This binding attribute name is used to identify an edit class control for HTML:

[WebBind(Name = "ControlName")]

WebEditBox

Property

Description

String Text

Gets/Sets the text value of the control.

String InnerHTML

Gets the inner HTML.

String InnerText

Gets the inner text.

tog_minusHyperlink

This binding attribute name is used to identify a hyperlink:

[WebBind (ID = "ID")]

WebLink

Method

Description

Void Click()

Performs a click on the bound link.

String InnerHTML

Gets the inner HTML.

String InnerText

Gets the inner text.

tog_minusButton (Web)

This binding attribute name is used to identify a button for web:

[WebBind (Name = "ControlName")]

WebButton

Method

Description

Void Click()

Performs a click on the bound control.

String InnerHTML

Gets the inner HTML.

String InnerText

Gets the inner text.

tog_minusWeb ComboBox

This binding attribute name is used to identify a Combobox control:

[WebBind (Name = "ControlName")]

WebComboBox

Property

Description

String Selected

Gets/Sets the selected item text.

String[] Items

Gets a string array containing all the different selection possibilities in the control.

String InnerHTML

Gets the inner HTML.

String InnerText

Gets the inner text.

tog_minusCheckbox

This binding attribute name is used to identify a checkbox control:

[WebBind (Name = "ControlName")]

WebCheckBox

Property

Description

Bool Checked

Gets/Sets checkbox state.

String InnerHTML

Gets the inner HTML.

String InnerText

Gets the inner text.

tog_minusRadio Button

This binding attribute name is used to identify a radio button:

[WebBind (Name = "ControlName")]

WebRadioButton

Property

Description

Bool Checked

Gets/Sets radio button selection.

String InnerHTML

Gets the inner HTML.

String InnerText

Gets the inner text.

tog_minusClick Operations

This binding attribute name is used to perform click operations:

[WebBind (Name = "ControlName")]

WebImage

Method

Description

Void Click()

Performs a click on the selected image.

String InnerHTML

Gets the inner HTML.

String InnerText

Gets the inner text.

tog_minusWebDiv Control

This binding attribute name is used to identify a webDiv control:

[WebBind (Name="webDiv")]

WebDiv

Property

Description

InnerText

Retrieves the text in the div control.

tog_minusWebForm Control

This binding attribute name is used to identify a webForm control:

[WebBind (Id="S53")]

WebForm

Property

Description

InnerText

Retrieves the text in the form.

tog_minusWebFrame Control

This binding attribute name is used to identify a webFrame control:

[WebBind (Name="s52")]

WebFrame

Property

Description

Exists

Checks whether the frame exists.

tog_minusWebSpan Control

This binding attribute name is used to identify a webSpan control:

[WebBind(Id="s_6_2_18_1")]

WebSpan

Property

Description

Exists

Checks whether the span exists.

InnerText

Gets the inner text.

Method

Description

Click

Clicks on the span control.

tog_minusWebContainer

This is an abstract base class for all web controls that can contain other controls. Controls inside this container can be accessed dynamically without first defining them in the Repository. This is useful when the content of the page is dynamic and the controls are accessed using coding.

Property

Control Type/Description

WebArea[]

Areas

WebLink[]

Links

WebTable[]

Tables

WebEditBox[]

EditBoxes

WebImage[]

Images

WebButton[]

Buttons

WebDiv[]

Div

WebRadioButton[]

Radio buttons

WebComboBox[]

ComboBoxes

WebCheckBox[]

Checkboxes

WebSpan[]

Spans

Element[]

Elements

String ExecuteScript(string js)

Executes JavaScript code.

Bool Exists

Checks whether the control exists.

tog_minusWebTable

This control represents the HTML table "<table>" tag. The control is very useful when showing repetitive occurrence of elements. The rows <tr> are represented using the WebTableRow class, and <td> is represented by WebTableCell.

Property

Control Type

TableRow[]

Rows

tog_minusWebTableRow

This control contains an array of cells.

Property

Control Type

WebTableCell[]

Cells

tog_minusWebTableCell

This control is a container. It can therefore host other controls dynamically.

For example:

        public void WindowOpened(object sender, EventArgs e)

        {

            if (sender is IEMainWindow)

            {

                IEMainWindow ieMainWindow = sender as IEMainWindow;

                Loggers.EventsLogger.Info("IE_WindowOpened " + System.Threading.Thread.CurrentThread.ManagedThreadId + ":" + ieMainWindow.Process.Id.ToString() + "/" + _ie.Id.ToString());

                if (ieMainWindow.Process.Id == _ie.Id)

                {

                    Loggers.EventsLogger.Info("IE_WindowOpened inside " + System.Threading.Thread.CurrentThread.ManagedThreadId);

                    Service.WindowOpened -= this.WindowOpened;

 

 

                    ieMainWindow.userEmailWebEditBox.Text = "a";

                    ieMainWindow.userPasswordWebEditBox.Text = "a";

                    ieMainWindow.login.Click();

                    ieMainWindow.computers.Click();

                    ieMainWindow.addToBasket.Click();

                    ieMainWindow.WebTextField.Text = _num.ToString();

                    ieMainWindow.gotoCheckout.Click();

                    ieMainWindow.processOrder.Click();

                    ieMainWindow.SenderCountryWebComboBox.Selected = "Israel";

 

                    SetResult(ieMainWindow.SenderCountryWebComboBox.Selected);

                }

            }

        }