How to get the IDObject with Attribute in SAP using Automation Anywhere with DLL? - dll

I'm developing an automation process on SAP with Automation Anywhere using the SAP DLLs provided by Automation Anywhere itself. I need to find IDObject with specify attribute to click/get value the specify element , but seems that there are no fuctions that allow you to do it. An example of code generated from the SAP recorder is the following:
session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell").setCurrentCell 0,"ICON_EXEC"
session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell").selectedRows = "0"
session.findById("wnd[0]/shellcont[1]/shell/shellcont[0]/shell").clickCurrentCell
using the dlls I have already tried the following functions:
Step 1 : Login on existing session (in this case 0)
Step 2 : Search Object by ID (in this case wnd[0]/shellcont[1]/shell/shellcont[0]/shell )
Step 3: CurrentCellRow (in this case 0)
Step 4: DoubleclickCurrentCell
The problem is that it doesn't click where i want, because as you can see there is the attribute "ICON_EXEC" that specify the element that i want to click . (i also tried to insert in the SearchObjectbyID all the string with the attribute, but it doesn't work)
Currently to avoid that i'm using Execute VBscript, but it seems that error handling does not work with scripts, so i would like to avoid them too
Any tips?
Thanks,
U.

You can find out the SAP-Object ID (IDObject) by recording a (.vbs-)macro in SAP:
Hit Alt + F12 or click the respective icon and choose "Record script and playback" ("Skript-Aufzeichnung und -Playback" in my screenshot):
In the following dialogue window, hit the record button and click the desired object:
Open the recorded .vbs-macro and and look for something like this (=the desired object ID):

You can handle errors in sap vb script , please refer below articles as reference and handle error as per you requirement.
1) https://answers.sap.com/questions/9676858/error-while-logging-to-sap-through-excel.html
2) https://wiki.scn.sap.com/wiki/display/Img/Scripting%3A+Error+Handling+and+Debugging

Related

ReadyAPI - Automation script to get the value from data source step

i am new to ReadyAPI and automation. But now i facing some issue where i wanted to fill in the consent page will the value that will get from the Data source.
The Role value is the value that i need to get and fill into the consent page
Here is my automation code to get the value:
I have to get the value from Data source, then fill into text box, then click button
This is the code im using:
document.getElementById('freeTextHabilitations').value = 'ObjectiveCombinaisons Data Source#Role';
document.getElementById('allowBtn').click();
I having problem where get nothing after the data source ran .
Anyone have any idea on how to inject the value from data source to automation script (java?)
Thank you.
Stanley,
Unclear as to how you are using DOM methods(with ReadyAPI), but to answer your question on accessing Data Source values
For that, you will need property expansion. So, your groovy script should be something like
xxxx.value = context.expand( '${ObjectiveCombinations Data Source#Role}' )
Property Expansion
This can be generated for you by using the Get Data dialog
Get Data Dialog

Karate UI automation, is it possible to make locators dynamic

Thanks Peter for API,Perf karate framework.
Now I am trying UI automation and it looks perfect as of now.
I have below question:
I have a menu bar with 15 items in it. they are named as following:
-Home
-Account
-groups
-settings
etc etc.
Locator for each one is like this "a[name=Home]" , "a[name=Account]", "a[name=groups]" . So ony the part after name= is something that is dynamic in nature. So my question is that is it possible to somehow make this dynamic locator?
I have written a called feature in which i have written steps to login and select a menu item. and I want to pass the menu item from calling feature in json like below:
if I want to click on Account menu
* call read(menuItem.feature) {menuItem: Account}
menuItem.feature looks something like below:
Given url 'xyz'
And input (username, userID)
And input (password, password)
And click("button[name=login]")
And click("a[name=Home]")
Here I want to make Home as dynamic in last click step on menuItem.feature so that I can pass other menu items and reuse all above steps/feature file to login everytime with different menu items passed from calling feature file in json{.
Again its just a query. I have currently written multiple scenarios to click on menu item and then in calling feature I call the called feature with tags like #Home,#account etc. and this works perfectly fine.
Also if there is any other better way to achieve this then please suggest
Yes. Let me put it this way, the things you see such as input('foo', 'bar') is pure JS behind the scenes. So normal programming-language rules apply. For example:
* def dynamic = 'foo'
* def locator = 'a[name=' + dynamic + ']'
* input(locator, 'some value')

calling a test case within a test case in SOAP UI

I am trying to call a test case within a test case using SOAP UI Pro. I created a reusable test case to generate a random VIN and intend to call this test case within other test case where applicable. I used property transfer, but I am unable to set the property in the test case to the value being returned.
I created a test case, wrote a groovy script, added a property to the test case and added a property transfer.See picture
I have been unable to set the property vin (highlighted) as shown in the picture. Any help would be appreciated.
I think this works with "DataGen" option.Lets say you have 2 testcases TC1 and TC2 Right click on TC1-> choose DataGen and add a property, write the groovy script for generating the random VIN.
Go to the TC2 where you want to reuse the VIN, right click on the property name and click on "get data" ->TC1->property name.
https://www.soapui.org/data-driven-tests/reference/datagen-teststep.html

Function keys In UFT

Version : Using HP-UFT Tool 11.53 Build 0382.
Question :Wanted to automate Function key F9 for my script but I am not able to as I do for normal keyboard keys what is method to do so.
Work Done : Try to Record for function key Hitting But no record is create for it.
Scenario : In my application on F9 press one popup would come and I just want to test it using UFT Tool.
You can use sendkeys, if you want to hit any key from keyboard. Try the below code.
Set oWscript = CreateObject("WScript.Shell")
oWscript.sendkeys"{F9}"
In UFT Window has a Type method, the parameter for this method is a string but there are special values for special keys. For you case you probably want micF9.
Please look and Window.Type's documentation for more details.

How can I store a dynamic text value in selenium ide and use it later in different window

I am new in selenium and trying to learning. I am creating a script and I got stuck here, I want to store a dynamic value from text message on web page ex. " Event Name:Test" this Event Name is dynamic and I want to store this and want to get in other window. In 2nd window i want to use this value(Test) to verify in the page
I tried storeValue, StoreText and storeAttribute command and getting error message for xpath or "element not found".
Please help me and advice me , what should I do?
Can You please suggest me the Xpath for storing and retrieving the event name. Please help me...
Thanks in advance,
Niru
If you are using the same test-case to navigate from page 1 to page 2 you can use the storeText function in the IDE to store the value of your event name. And then you can use the same variable in the page 2 for verification.
For example, in page 1 to store the value of event you use:
storeText(locator1, temp)
And then on page 2 you use assert:
assertText(locator2, ${temp})