If Cell is Equal or Greater than then

Ask general questions here.
Posts: 7
Joined: Mon Mar 12, 2012 3:53 pm

If Cell is Equal or Greater than then

Post by byonush » Tue Mar 27, 2012 3:10 am

Currently I am working on a automated testing for a trading application. I have my first recording that will launch the application and then verify I am in the QA environment before proceeding. Second I call up my program called DialogWatcher (thanks to the blogs on this site) and next I bring up my place trade test. I have created a stored procedure and have my fields mapped which is working fine. What I am trying to do is after I enter the broker and symbol and have the tab key pressed 1 of 3 things will happen on the screen all within the same container.

1. The Table will populate rows with negative numbers.
2. The Table will populate rows with positive number.
3. The Table will not populate any rows because we hold no trades in that symbol

I have created a usercode step after the symbol is entered with the following:

If repo.PlaceTradeScreen.OrderShareTotal.RowRow_1.CellFirm_Total_row_0 >= 0 Then

ElseIf repo.PlaceTradeScreen.OrderShareTotal.RowRow_1.CellFirm_Total_row_0accesbilevalue <0 Then
ElseIf repo.PlaceTradeScreen.OrderShareTotal.RowRow_1.CellFirm_Total_row_0.Visible = False Then
End If

If the table populates and row 1 CellFirm_Total_row_0 has zero or greater than I want the Buy button clicked. If the cell populates with a negative number I want to cover the trade and if there is no row present I want to buy.

The problem I am having is if I put at the end of CellFirm_Total_row_0.Text it will take the code but running through it will fail. If I drop the .text I get a message Operator '>=' is not defined for types 'Ranorex.Cell' and 'Integer'. (BC30452) - C:\Users\autadmin\Documents\Ranorex\RanorexStudio Projects\TBX_TRADE\TBX_TRADE\Place_Trade.UserCode.vb:44

I apologize if I am unable to explain what I am trying to do the best. I am not a developer so I am just piecing things together and learning as I go. Any help is very much appreciated.

User avatar
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark

Re: If Cell is Equal or Greater than then

Post by artur_gadomski » Tue Mar 27, 2012 8:14 am

If your .text value returns a string then you probably want to parse text value to int. http://msdn.microsoft.com/en-us/library/b3h1hf19.aspx

int.Parse("34") will return a number that you can compare to 34.