I am using SapGuiLibrary to automate some tests in SAP GUI screens using the Robot Framework. To identify the elements I am using the Script Tracker and I was able to identify the element I want to interact with, but when I click on it, or change the value of the field I get the error message:
ValueError: Cannot find element with id 'wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT01/ssubSUBSCREEN_BODY:SAPMV50A:1202/tblSAPMV50ATC_LIPS_OVER_INB/txtLIPSD-G_LFIMG[2,0]'
Here is what I'm doing:
*** Settings ***
Library SapGuiLibrary
Resource ../Resource/Login_PartLinQ.robot
*** Variables ***
${Btn_DeleteRow} wnd[1]/tbar[0]/btn[14]
${SAP_Title} /app/con[0]/ses[0]/wnd[0]/titl
${Tab_DocsXVendor} wnd[0]/usr/cntlMEALV_GRID_CONTROL_VL31/shellcont/shell
${Txt_DeliveryQtd} wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV50A:1202/tblSAPMV50ATC_LIPS_OVER_INB/txtLIPSD-G_LFIMG[2,0]
${Txt_DocCategory} wnd[0]/usr/ctxtSP$00004-LOW
${Txt_Material} wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV50A:1202/tblSAPMV50ATC_LIPS_OVER_INB/ctxtLIPS-MATNR[1,0]
${Txt_MaterNumber} wnd[0]/usr/ctxtS_MATNR-LOW
${Txt_Plant} wnd[0]/usr/ctxtSP$00023-LOW
${Txt_PurchasDoc} wnd[0]/usr/ctxtSP$00005-LOW
${Txt_PurchasGroup} wnd[0]/usr/ctxtSP$00006-LOW
${Txt_SelecParam} wnd[0]/usr/ctxtSP$00010-LOW
*** Keywords ***
### Given ###
that the user is logged into PartLinQ
${title} Get Value ${SAP_Title}
Should Be Equal ${title} SAP Easy Access ${SPACE}-${SPACE} User Menu for test ID for automated Test Scripts 1
### When ###
the user update the Business Partner
Run Transaction VL31N
Send Vkey Shift + F4
Input Text ${Txt_MaterNumber} VO 82713508
Input Text ${Txt_PurchasDoc} 1000005844
Set Focus ${Txt_PurchasGroup}
Send Vkey F2
Click Element ${Btn_DeleteRow}
Set Focus ${Txt_DocCategory}
Send Vkey F2
Click Element ${Btn_DeleteRow}
Set Focus ${Txt_SelecParam}
Send Vkey F2
Click Element ${Btn_DeleteRow}
Set Focus ${Txt_Plant}
Send Vkey F2
Click Element ${Btn_DeleteRow}
Send Vkey F8
Select Table Row ${Tab_DocsXVendor} 0
Send Vkey F8
Input Text ${Txt_DeliveryQtd} 5
That's what I got from Script Tracker:
$ID = Invoke-Method -object $session -methodName "findById" -methodParameter @("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV50A:1202/tblSAPMV50ATC_LIPS_OVER_INB/txtLIPSD-G_LFIMG[2,0]");
Set-Property -object $ID -propertyName "text" -propertyValue @("5");
tabpT\01where\seems to be removed (SapGuiLibrary bug or is it only when the message is output?), or the subscreen 1202 is not under the tab namedtabpT\01(I guess this may happen because the tabs are dynamically assigned). Maybe you could useGet ValueorTake Screenshotto help troubleshooting. - Sandra Rossi