Question
Deutsche Telecom AG
RO
Last activity: 19 Jul 2023 10:21 EDT
SAP Treeview Component issue
Hello,
I interrogated a Treeview in SAP and I want to click a button that is located inside a node.
Any ideas of how I can achieve this? During interrogation I can only fetch the treeview, also there are no virtual controls inside the nodes.
Check attachment, the button is the green one.
Thanks!
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
@AndreiN16802781I don't have ready access to an SAP instance handy, however I believe in the past I have worked with the TreeViews. Typically, there is a way to access the nodes. You usually need to do this with proxies, however you may have a method to select the node you need with a direct method. Would you please post a screenshot of the Properties and Methods that you can see for the control?
Deutsche Telecom AG
RO
@ThomasSasnett I attached a new printscreen with properties and some methods.
So, if you check my first post in the screen you will see a node named DATUM, I can click/expand/select that node using ClickNodeByText, but I am also interested in clicking the little green square button that is inside.
Can I use a path method or do you have other ideas?
Pegasystems Inc.
US
@AndreiN16802781 You'll need to get a list of the nodes beneath that node. Do you have any methods or properties that gives you a list of the nodes?
Deutsche Telecom AG
RO
@ThomasSasnett From what I see there aren't any methods that return a list. I only have the properties Count and Nodes that are available for the treeview component.
Pegasystems Inc.
US
@AndreiN16802781 Here is an example I put together from another TreeView control. This isn't SAP, but the control should be the same.
Deutsche Telecom AG
RO
@ThomasSasnett I really appreciate the work you put into this, thanks for all the help.
The only issue is that I don't see the First method listed anywhere. I attached a new ps.
Pegasystems Inc.
US
@AndreiN16802781 That feature is called LINQ methods and was released in late March with 22.1.8. If you are using an older version, you would need to upgrade to use it. This method is a simpler way of retrieving the first child node, but you could replace it with the Get method and pass it the index of 0 to get the first child node.
Deutsche Telecom AG
RO
@ThomasSasnett Hmm ok, I will try upgrading to see if the LINQ methods work as expected. I already tried the way where I use get with index 0, it throws an error, memberName should not be null ->
Pegasystems Inc.
US
@AndreiN16802781I would try validating some basic things first. First, get a count of the nodes. I would also iterate through each of the nodes and display some property of each node (maybe the path and/or text since some don't have text). On each node, try checking its HasChildren property and if it does, iterate through its children, etc. This will let you know if you are actually seeing all of the nodes.
I can't really troubleshoot via the community, so I would have to direct you to global customer support if you would like to get some assistance.
Deutsche Telecom AG
RO
@ThomasSasnett thanks for all the help, I managed to get what I wanted using this code.
Pegasystems Inc.
GB
@AndreiN16802781 if your issue is resolved could you hit the 'Accept Solution' button against the correct reply?
Updated: 19 Jul 2023 10:03 EDT
Deutsche Telecom AG
RO
@MarijeSchillern I am still looking for a better(stable) solution where I don't use SendKeys method, I will post it here if I find one, if not I will accept the current one.
Pegasystems Inc.
US
@AndreiN16802781 In your automation, I see that you are calling PerformClick on the node before SendKeys. Is the PerformClick doing anything? What happens if you use PerformDoubleClick? You could also try selecting the node before PerformClick. You might also try calling PerformClick but giving it coordinates. You might offset by 10 pixels or so such that the click occurs away from the control edges.