I'm wondering about way to edit multiple selections but with different texts
For example:
arr=['hi','i','am','your','array','can','change','me','quickly','please']
arr=['test1','text','foo','test','fast','yes','test2','test3','text2','text3']
I have array of ten elements and I want to change them all with different texts.
Ordinary way to select one then change it. If you use multiple selections all of them are replaced with the same new text.
The question there: any way to change them faster?
I think there may be a way to change it like Emmet in HTML when you enter Emmet code PhpStorm convert it and take you inside red box in each element to write inside it one by one.
i have found the solution to make it easily to edit the array
just using the find ctrl+f and then use f3 to get next value to edit
in the search we can enter the regular expression that will find any matched values
(?<=')\w+(?=')|(?<=,)\w+(?=,)|(?<=\[)\w+(?=,)|(?<=,)\w+(?=])
(?<=')\w+(?=') : any text inside single quotes symbol ' can be changed double "
(?<=,)\w+(?=,): any word between commas for numbers and variables in the array
(?<=\[)\w+(?=,): the first element of the array if it as number or variable
(?<=,)\w+(?=]) : the last element in the array if it as number or variable
| : or operator
Related
I would like to create a User Snipper in VS Code that is a combination of variables and plaint text. This can typically be achieved by combining variables and plain text with a whitespace between then. But I would like to ad a variable next to a text without a whitespace.
For Example, I would like to create the current timestamp like this:
2022-02-19T21:02:24-0530
Below is what I tried
$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATET$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND-0530
Notice the T in between $CURRENT_DATE & $CURRENT_HOUR
OUTPUT:
2022-02-CURRENT_DATET21:06:12-0530
You can add $ symbol before the plain-text you want to add.
In this case, you need at add $T instead of T
$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE$T$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND-0530
Note that $T will get considered as a placeholder, and it will be the last item selected while tabbing through the inserted snippet.
I am still a bit new to the robot framework but please rest assured I am constantly reading its User Guide. I am a bit stuck now with one test case.
I do have a list of individual words, that I need to verify on a page, mostly German translations of field labels if they appear correctly or are found in an element at all.
I have created a list variable as follows:
#{GERMAN_WORDS} | Benutzer | Passwort | Sendung | Transaktionen | Notiz
I have the following locator that contains the text labels on the webpage, and the one I need to verify:
${GENERAL_GERMAN_BOARD} |
xpath=//*[#id="generalAndIncidents:generalAndIncidentsPanel"]
I would like to check every single word one by one from the list variable, whether they are present in the locator above.
I did create the following keyword for this purpose, however I might be missing something because it calls the entire content of my list variable, instead of checking the words from it one by one:
Block Text Verification
[Arguments] ${text_list_variable} ${locator_to_check}
Wait Until Element is Visible ${locator_to_check}
FOR ${label} IN ${text_list_variable}
${labelTostring} Convert to String ${label}
${isMatching} = Run Keyword and Return Status Element Should Contain ${locator_to_check} ${labelTostring}
Log ${label}
Log ${isMatching}
Exit For Loop If '${isMatching}' == 'False'
END
I am getting the following output for this:
Element
'xpath=//*[#id="generalAndIncidents:generalAndIncidentsPanel"]' should
have contained text '['Benutzer', 'Passwort', 'Sendung',
'Transaktionen', 'Notiz']' but its text was.... (and it lists all the
text from my locator)
So, it is basically not checking the words one by one.
Am I doing something wrong here? Is this a bad approach I am trying to do here?
I would be grateful if anyone could provide me some hint on what I should do here instead!
Thank you very much!
You've made one small but crucial mistake - the variable in this line here:
FOR ${label} IN ${text_list_variable}
, should be accessed with #:
FOR ${label} IN #{text_list_variable}
The for-in loops in RF expect 1 or more arguments of the looped over values, and the # expands a list variable to its members.
How can I search names starting from first letter that user types, I want to know if user types B then names starting from B must be displayed rather than "SBI" word where B comes in second position. I want to search specific words which has first word match.
for example: if
list ={SBI,
BSI,
isb,
bsisib,
be happy,
dont worry,
hello}
Then If i type h character then I want all the words starting from 'h'. but when i tried it shows 'be happy' 'hello' result for h. I want hello only. Thank you
If you're list isn't extremely long try applying a regular expression on each item in ng-repeat filter.
Not sure if you want first word or first character in each word.
Try the following plunker.
If you are using this on input field, then
I suggest you to use an existing autocomplete solution for angularjs. There are many of them out there and are quite easy to use.
http://ngmodules.org/modules/ngAutocomplete
Plunkr:http://plnkr.co/edit/il2J8qOI2Dr7Ik1KHRm8?p=preview
http://angular-ui.github.io/bootstrap/
Check the typeahead from angular ui bootstrap.
Or just google angularjs autocomplete, you will find tons of results.
Could someone please help me with creating a "character array" with this sort of data:
ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Escherichia_coli_ATCC_8739_uid58783/NC_010468.gff
Instruction from our collaborator:
One can copy and paste a gff file into a character array by typing gff={} and then copy and “paste excel data”
But I can somehow only save it as a cell array and hence the script downstream can't run properly.
additional info
I need to use the .gff file in a .m script (that I got from someone else) to parse my sequences.
Here's the part of my script that I think pertains to my question:
genelist=gff(:,3);
starts=gff(:,4);
ends=gff(:,5);
names=gff(:,9);
genelogical=strncmp('gene',genelist,4);
Therefore I want 9 columns with information like this:
1. seqID;
2. source;
3. type;
4&5. start and end;
6. score;
7. strand;
8. phase
9. attributes
Also when I saved the cell array as "cell", and tried to convert it into a character array by typing
char(cell)
I got this error message:
cell elements must be character arrays
So guess that doesn't work...
edit over
Anyone has any idea?
Thanks,
Joyce
The instructions you were given are referring to the following context menu item accessible from the "Variables" editor:
First, run at the command line gff={}; to make an empty cell array. Then double click the gff variable in the Workspace tab to get the above editor window. Click on the square regino to the top left of the table to select all cells, then right click to get the displayed menu, and paste the data. You should end up with the following if the paste worked correctly (it could actually take a couple of minutes - check CPU usage):
Then the commands you posted work. The strncmp says definitively that as cell array is needed.
There's a webpage I'm trying to test that has multiple textboxes. I've gotten to the point where I can retrieve all the values in every textbox and store them into an array, but I'm stuck on how to type those same values into the textboxes again.
Here's what I have so far in Selenium:
Larger view: http://i.stack.imgur.com/rb93k.png
The stored variable 'count' is simply the number of rows in the table, and isn't causing a problem. The part I've circled in red is where the problem comes in.
When I run this test, instead of typing the value stored in the array at that index, it simply types:
This continues all the way until the end.
The variable 'i' is properly inserted, but for some reason instead of grabbing that value, it simply types it into the textbox.
Does anyone know how I can get the correct value in the array?
Below is the problematic line:
type | javascript{this.browserbot.getUserWindow().getTestingHooks('TextBoxValue_' + storedVars['i'])} | ${textBoxArray[${i}]} |
i'm using Selenium library through Robot Tests Framework. I'm not using any IDE, just using HTML to make test cases and defining new keywords.
When ever i want to access a list variable item, i just use the following sintaxe
#{list_variable_name}[0]
note that ${variable_name} is to access a single value variable or the reference to the list variable. If we want to access a list item we need to use # instead of $.
If i understand your situation right,
#{textBoxArray}[${i}] should work for you.
Try also
${textBoxArray}[${i}] because it seems that your are simply misplaycing the last }.
More details at
http://robotframework.googlecode.com/svn/tags/robotframework-2.5.4/doc/userguide/RobotFrameworkUserGuide.html#list-variables
I think you need to replace your circled reference to ${textBoxArray[${i}] with
javascript{storedVars['textBoxArray['+storedVars['j']+']']}
Read this blog post for more information, especially the section about 'Setting and getting variables'.
Quoting from the article, consider
store | 10 | x
This obviously sets x=10. There are a couple of ways to reference it:
${x} or storedVars['x']. They're not the same.
In particular
You can't assign anything to ${x}.
You can insert one more command before your problematic line:
getEval | storedVars['text'] = storedVars['textBoxArray'][storedVars['i']];
And change problematic line to:
type | javascript{this.browserbot.getUserWindow().getTestingHooks('TextBoxValue_' + storedVars['i'])} | ${text}
Also it will be probably helpful to declare your array in the beginning of the test:
storeEval | new Array() | textBoxArray