Public Sub Invoke_Action_Side() If repo.PlaceTradeScreen.OrderShareTotal.RowRow_1.CellFirm_Total_row_0.Text >= 0 Then Report.Log(ReportLevel.Info, "Invoke Action", "Invoking Press() on item 'PlaceTradeScreen.Side.ButtonBUY'.", repo.PlaceTradeScreen.Side.ButtonBUYInfo) repo.PlaceTradeScreen.Side.ButtonBuy.Press() ElseIf repo.PlaceTradeScreen.OrderShareTotal.RowRow_1.CellFirm_Total_row_0.Text <0 Then Report.Log(ReportLevel.Info, "Invoke Action", "Invoking Press() on item 'PlaceTradeScreen.Side.ButtonCVS'.", repo.PlaceTradeScreen.Side.ButtonCVSInfo) repo.PlaceTradeScreen.Side.ButtonCVS.Press() ElseIf repo.PlaceTradeScreen.OrderShareTotal.RowRow_1.CellFirm_Total_row_0Info.Exists == False Then Report.Log(ReportLevel.Info, "Invoke Action", "Invoking Press() on item 'PlaceTradeScreen.Side.ButtonBUY'.", repo.PlaceTradeScreen.Side.ButtonBUYInfo) repo.PlaceTradeScreen.Side.ButtonBuy.Press() End If
User code with If and ElseIf
User code with If and ElseIf
I have the first If and ElseIf working properly. If the cell it looks at has a positive number it will click the BUY button. If it has a negative it will click the CVS button. The problem I am having is when the cell is not there at all. What I would like to do is the above and if the first two conditions are not there meaning no cell at all then click the BUY button and continue. Right now if it comes to a symbol that does not populate a cell the playback stops. Here is the code I am using. I have tried everything I can think of for the final ElseIf but nothing is working for that.
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: User code with If and ElseIf
Hi,
The clause where you check if the cell exists have to be the first one, because otherwise if the cell doesn't exist you will get a failed to find item error message.
Regards,
Markus
Ranorex Support Team
The clause where you check if the cell exists have to be the first one, because otherwise if the cell doesn't exist you will get a failed to find item error message.
Regards,
Markus
Ranorex Support Team