Need some help the following

Ask general questions here.
ereid
Posts: 3
Joined: Fri Jan 04, 2019 6:09 pm

Need some help the following

Post by ereid » Tue Aug 13, 2019 9:19 pm

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
Attachments
Snapshot of main code.JPG
Snapshot of main code.JPG (206.43 KiB) Viewed 79 times
WebApp.JPG
WebApp.JPG (168.51 KiB) Viewed 79 times
Last edited by ereid on Wed Aug 14, 2019 5:26 pm, edited 2 times in total.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5071
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Need some help the following

Post by odklizec » Wed Aug 14, 2019 7:13 am

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?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration