Page 1 of 1

Need some help the following

Posted: Tue Aug 13, 2019 9:19 pm
by ereid
I am trying using the first set of the grid there are two Participant, when selected the second grid will populate all the records belonging to this Participant.

Test condition is to be able to modify the amount field to adjust the Percent allocated or to delete a record for the listing of records and to be able the same condition on the Participant when selected.

I am able to select the Participant without no problem, but when I am trying to modify or delete the records belonging to the selected Participant the user code below sometime work

Modify section of the code:

if(ActionID.Trim() == "UpdateParticipant")
{
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence '{Tab}' with focus on 'webdocumentInfo'.", webdocumentInfo);
webdocumentInfo.FindAdapter<WebDocument>().EnsureVisible();
Keyboard.Press("{Tab}");
Report.Log(ReportLevel.Info, "Delay", "Waiting for 500ms.");
Delay.Duration(500, false);
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence '{Tab}' with focus on 'webdocumentInfo'.", webdocumentInfo);
webdocumentInfo.FindAdapter<WebDocument>().EnsureVisible();
Keyboard.Press("{Tab}");
Report.Log(ReportLevel.Info, "Delay", "Waiting for 500ms.");
Delay.Duration(500, false);
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence '{Tab}' with focus on 'webdocumentInfo'.", webdocumentInfo);
webdocumentInfo.FindAdapter<WebDocument>().EnsureVisible();
Keyboard.Press("{Tab}");
Report.Log(ReportLevel.Info, "Delay", "Waiting for 500ms.");
Delay.Duration(500, false);
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence '{Tab}' with focus on 'webdocumentInfo'.", webdocumentInfo);
webdocumentInfo.FindAdapter<WebDocument>().EnsureVisible();
Keyboard.Press("{Tab}");
Report.Log(ReportLevel.Info, "Delay", "Waiting for 500ms.");
Delay.Duration(500, false);
Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'inputtagInfo' at 14;16.", inputtagInfo);
inputtagInfo.FindAdapter<InputTag>().Click("14;16");
Report.Log(ReportLevel.Info, "Delay", "Waiting for 500ms.");
Delay.Duration(500, false);
Report.Log(ReportLevel.Info, "Get Value", "Getting attribute 'Value' from item 'inputtagInfo' and assigning its value to variable 'Amount'.", inputtagInfo);
AmountTag = inputtagInfo.FindAdapter<InputTag>().Element.GetAttributeValueText("Value");
Report.Log(ReportLevel.Info, "Delay", "Waiting for 500ms.");
Delay.Duration(500, false);
if (!!string.IsNullOrWhiteSpace(AmountTag))
{
Report.Log(ReportLevel.Info, "Set value", "Setting attribute Value to '$Amount' on item 'inputtagInfo'.", inputtagInfo);
inputtagInfo.FindAdapter<InputTag>().Element.SetAttributeValue("Value", Amount);
Report.Log(ReportLevel.Info, "Delay", "Waiting for 500ms.");
Delay.Duration(500, false);
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence '{Return}' with focus on 'inputtagInfo'.", inputtagInfo);
inputtagInfo.FindAdapter<InputTag>().PressKeys("{Return}");
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence '{Return}'.");
Keyboard.Press("{Return}");
Report.Log(ReportLevel.Info, "Delay", "Waiting for 500ms.");
Delay.Duration(500, false);
}
}
// Delete section code
if(ActionID.Trim() == "DeleteParticipant")
{
divtagInfo.FindAdapter<DivTag>().Click("18;6");
Report.Log(ReportLevel.Info, "Delay", "Waiting for 500ms.");
Delay.Duration(500, false);
}

The Version Ranorex is 9.1

Re: Need some help the following

Posted: Wed Aug 14, 2019 7:13 am
by odklizec
Hi,

I'm afraid, that without additional details, there is no chance to tell what's wrong. At first, could you please explain this?...
I have been try to use get value and set value in a user code to get the value of grid cell and set the value to with data bound field which work but not all the time.
What do you mean exactly? The data are not passed, or either of the required element is not found? Is there any error message? Have you tried to perform the get/set actions in recording, i.e. avoiding custom code?

At next, what's your Ranorex version? And finally, but most importantly, could you please post a Ranorex snapshot (NOT screenshot) of your AUT? Also, please post xpath behind the inputtagInfo element.

Oh an one more thing. I'm not quite sure what exactly you truing to do with your code. But all that TABing seems to be pretty unstable and something that may eventually end up with clicking different than expected element?