Multiple Keywords with same name found but there is only unique keyword - python-3.x

*When i run my robot tests it says Multiple keywords with name 'Set
Variable Value for' found. Give the full name of the keyword you want to use:
step_definitions.Set Variable Value for
variable_handler.Set Variable Value for
It does this for all the keywords mentioned in variable_handler.py
Is there something that i am missing? Do we need to give the name
of python file that has that keyword?*
found not much online. have added the library in the settings.
Variable_handler.py
```#keyword(name='Set Variable Value for')
def Set_Variable_Value_for(tag, value):
my_token_file = 'Resources/written_variables.yml'
data = None
with open(my_token_file, 'r') as testData:
data = yaml.load(testData)
data[tag] = value
with open(my_token_file, 'w') as writeTestData:
print(ruamel.yaml.dump(data, writeTestData,
Dumper=ruamel.yaml.RoundTripDumper))```
step_definitions.py
'''#keyword(name='Set Start Time for Test')
def Test_Start_Time():
tz = timezone('UTC')
Time_Now = datetime.now(tz)
naive_date = Time_Now.replace(tzinfo=None)
Set_Variable_Value_for('START_TIME', naive_date)```
Test.robot
'''Create a New Member
[Documentation] Add a New Member
[Tags] CreateMember MemberAndProjectCreationFlow SanityTest
All
Login to Platform Analytics
Verify Member List Page Elements
Click on Add Member
Add Member Breadcrumb is displayed
Add New Member Details
Verify New Member Creation
Search for the Member ${NEW_MEMBER_NAME_GLOBAL}
Search the Results and Go To ${NEW_MEMBER_NAME_GLOBAL}
${Member_Row_Locator} ${Member_Column}
${MEMBER_HOMEPAGE} = Replace String ${MEMBER_HOME}
MEMBERHOME ${NEW_MEMBER_SCHEMA_GLOBAL}
Set Global Variable ${MEMBER_HOMEPAGE_GLOBAL}
${MEMBER_HOMEPAGE}
đźš©Set Variable Value for MEMBER_HOMEPAGE ${MEMBER_HOMEPAGE}
Log To Console Member Creation Successful.```
It should work without specifying the python file that contains
the key word. I have imported all the things required like variable_handler and step definitions

The root of the matter is that you have two or more keywords with the same name imported into the test. When you try to run the keyword Set Variable Value for, robot doesn't know which of the keywords to run. It has no way of knowing if the two names represent two different functions or the same function in two different libraries.
You have three possible solutions:
As the error suggests, you can specify the full path to the keyword, such as step_definitions.Set Variable Value
You tell robot to give precedence to one library over the other using the built-in keyword Set Library Search Order.
You can modify your libraries so that you don't have duplicate keyword names
For more information see Handling keywords with same names in the robot framework user guide.

Related

Filter on folder and item type in ArcGIS Online

enter image description hereI want to change the extent of all webmaps in a given folder in ArcGIS Online. However, the standard query command (gis.content.search) does not have a property that allows searching only in a folder.
On the other hand, once I have a list of all items in a given folder, I am unable to only filter all webmaps out. This is the script I used (see also the image):
folderowner = 'my_username'
updatefolder = 'testfolder'
user = gis.user.get(username=my_username)
user
rightFolder = user.items(folder = updatefolder)
rightFolder
for item in rightFolder:
print(item.type)
for item in rightFolder:
if (item_type = "Web Map"):
print (item.title)
screenshot of script
I can print the Item types. But once I try to list only Web Maps, I get a Syntax error. I have tried many different notations.
I can pass the types in a print command, but I can't use the types as a way to filter. Where I am basically looking for is thus a way to get only web maps in a given folder.

How to create source type image in python code?

I am trying to create the source type image from python script in obs. Want to know proper steps to create source in script. I already checked, no proper doc for python scripting available.
obs.obs_source_create('banner-image','xyz')
obs.obs_source_create('banner-image','xyz')
Logs
TypeError: obs_source_create() takes exactly 4 arguments (2 given)
I want to create source type image from scrip & add that source to my current scene
This may be a simple FFI implementation, so try:
obs.obs_source_create('banner-image', 'xyz', None, None)
Source: First hit on Google when searching for "obs_source_create":
https://obsproject.com/docs/reference-sources.html
Excerpt:
obs_source_t *obs_source_create(const char *id, const char *name, obs_data_t *settings, obs_data_t *hotkey_data)
Creates a source of the specified type with the specified settings.
The “source” context is used for anything related to presenting or modifying video/audio. Use obs_source_release to release it.
Parameters:
id – The source type string identifier
name – The desired name of the source. If this is not unique, it will be made to be unique
settings – The settings for the source, or NULL if none
hotkey_data – Saved hotkey data for the source, or NULL if none
Returns:
A reference to the newly created source, or NULL if failed

Dynamically passing a row number to Session.findbyid method

I am trying to write a script which posts invoices in SAP through Excel (fairly new to this), and am running into the following error:
"The control could not be found by id".
The error is coming up at the below line:
session.FindById("wnd[0]/usr/subITEMS:SAPLFSKB:0100/tblSAPLFSKBTABLE/ctxtACGL_ITEM-HKONT[1,w_counter]").Text = w_glacc
Here, I am trying to pass the GL account number in the first row. There can be multiple rows, so I was hoping that instead of passing ctxtACGL_ITEM-HKONT[1,0]").Text, ctxtACGL_ITEM-HKONT[1,1]").Text etc. I wanted to initialize a counter and pass that value into this method.
Is there any way this can be achieved?
Found a solution:
Instead of passing just w_counter I had to pass "&w_counter&".
Previously, code was:
session.FindById("wnd[0]/usr/subITEMS:SAPLFSKB:0100/tblSAPLFSKBTABLE/ctxtACGL_ITEM-HKONT[1,w_counter]").Text = w_glacc
Now, it is:
session.FindById("wnd[0]/usr/subITEMS:SAPLFSKB:0100/tblSAPLFSKBTABLE/ctxtACGL_ITEM-HKONT[1,"& w_counter &"]").Text = w_glacc

How to save value of found document in mongoose as a variable?

Let's say I use findbyID{} to find a specific document in my collection, and this document has the value totalMedals to which I want to add the local variable medalsWonSinceLastUpdate. I would need a function along the lines of totalMedals = previousTotalMedals + medalsWonSinceLastUpdate, which would mean I need to capture the previous totalMedals in a variable. How would this be possible?
I have experimented with an ejs file that contains the value I want to access and then tried to access it through req.body.value, but this throws an error. I can run queries that find the documents, but I run into a brick wall when it comes to taking the variables to a wider scope.

exclude a certain path from all user searches

Unfortunately we have a special folder named "_archive" in our repository everywhere.
This folder has its purpose. But: When searching for content/documents we want to exclude it and every content beneath "_archive".
So, what i want is to exclude the path and its member from all user searches. Syntax is easy with fts:
your_query AND -PATH:"//cm:_archive//*"
to test:
https://www.docdroid.net/RmKj9gB/search-test.pdf.html
take the pdf, put it into your repo twice:
/some_random_path/search-test.pdf
/some_random_path/_archive/search-test.pdf
In node-browser everything works as expected:
TEXT:"HODOR" AND -PATH:"//cm:_archive//*"
= 1 result
TEXT:"HODOR"
= 2 results
So, my idea was to edit search.get.config.xml and add the exclusion to the list of properties:
<search>
<default-operator>AND</default-operator>
<default-query-template>%(cm:name cm:title cm:description ia:whatEvent
ia:descriptionEvent lnk:title lnk:description TEXT TAG) AND -PATH:"//cm:_archive//*"
</default-query-template>
</search>
But it does not work as intended! As soon as i am using 'text:' or 'name:' in the search field, the exclusion seems to be ignored.
What other option do i have? Basically just want to add the exclusion to the base query after the default query template is used.
Version is Alfresco Community 5.0.d
thanks!
I guess you're mistaken what query templates are meant for. Take a look at the Wiki.
So what you're basically doing is programmatically saying I've got a keyword and I want to match the keywords to the following metadata fields.
Default it will match cm:name cm:title cm:description etc. This can be changed to a custom field or in other cases to ALL.
So putting an extra AND or here of whatever won't work, cause this isn't the actual query which will be built. I can go on more about the query templates, but that won't do you any good.
In your case you'll need to modify the search.get webscript of Alfresco and the method called function getSearchResults(params) in search.lib.js (which get's imported).
Somewhere in at the end of the method it will do the following:
ftsQuery = '(' + ftsQuery + ') AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating" AND -TYPE:"st:site"' + ' AND -ASPECT:"st:siteContainer" AND -ASPECT:"sys:hidden" AND -cm:creator:system AND -QNAME:comment\\-*';
Just add your path to query to it and that will do.

Resources