cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Double click not working in python

Former Member
0 Likes
3,682

Hi,

I'm trying to access information by double click on a cell and it is not working. After the entering into the screen i'm unable to print any details. the automation fails.

session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").selectedNode = "0000000022"
session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode("0000000022")
session.findById("wnd[0]/usr/ctxtER_STAT").text = "R"
session.findById("wnd[0]/usr/ctxtER_BP2-LOW").text = b+"*"
session.findById("wnd[0]/usr/ctxtER_RTN_D-LOW").text = today
session.findById("wnd[0]/usr/ctxtER_RTN_D-HIGH").text = today
session.findById("wnd[0]/tbar[1]/btn[8]").press()
---Code works fine until here The screen with the information reflects-- The below code does not work-            
print("In the details page")
session.findById("wnd[0]/usr/lbl[3,5]").setFocus()
print("focus")
session.findById("wnd[0]/usr/lbl[3,5]").caretPosition = 0
session.findById("wnd[0]").sendVKey(2)
print("Success")

Attached is image of the view. I'm unable to change this to a grid view.

Regards,
Renato.



View Entire Topic
Sandra_Rossi
Active Contributor

You don't explain what goal you want to achieve.

Anyway, if you expect to set the cursor at the output-only text ("label") which starts at column 3, row 5, then this code is fine:

session.findById("wnd[0]/usr/lbl[3,5]").setFocus()

If you want to position at "RR" (output-only text starting at column 22, row 0), then you should do:

session.findById("wnd[0]/usr/lbl[22,0]").setFocus()

Concerning the double-click, it corresponds to pressing F2, so this code is fine:

session.findById("wnd[0]").sendVKey 2 ' Press F2
Former Member
0 Likes

Hi Sandra,

I'm trying to double click on the label. Which would in turn take me to the next screen. The challenge i'm facing it that it is not recognizing either the

session.findById("wnd[0]/usr/lbl[3,5]").setFocus()

Or

session.findById("wnd[0]").sendVKey 2 ' Press F2

I'm not sure why it is not working.

There is a tiny check box beside the label. I have tried setting that as true as well and it still does not work. Which is quite puzzeling for me.

Regards,

Renato.

Sandra_Rossi
Active Contributor
0 Likes

I don't understand why your code doesn't work and my code works, although it has exactly the same lines of code.

Are you sure that there's a label starting at column 3 (4th column) and row 5 (6th row)? If no and if SAP GUI doesn't send an error message, then it means that you handle all errors, so you will have big issues to troubleshoot your code! Just don't handle all errors.

What checkbox are you talking about?

Could you please provide screenshots corresponding to what you expect?

Former Member
0 Likes

This is the code for the check box and box is being highlighted but it does not get selected.

session.findById("wnd[0]/usr/chk[1,5]").selected = True
Former Member
0 Likes

check-box.png

This is the check box image and im not trying to catch any error.

I tired selecting all the checkbox using the below code and it does not work.

session.findById("wnd[0]/tbar[1]/btn[5]").press()

Not sure it is a problem with the GUI. When i record it i find the options are correct.

Sandra_Rossi
Active Contributor
0 Likes

Here is the image posted by the OP:

Sandra_Rossi
Active Contributor
0 Likes

It doesn't look like the original question, which was about double-clicking an output-only text field. Is this solved now?

I don't understand why you show all these different codes. Could you just show what code the Script Recorder produce when you click the checkbox please?

Sandra_Rossi
Active Contributor
0 Likes

I just did the recording. I confirm that it get the same and it works for me:

session.findById("wnd[0]/usr/chk[1,5]").selected = True