"Element locator with prefix '| id' is not supported" error in Robot framework - robotframework

I am using robot framework to test a GUI application ,
when I try to run the test case , got an error like
"Element locator with prefix '| id' is not supported " .
But I am using the latest version of selenium2library i.e.2.39.0 .
I will be thankful ,If somebody helps me out regarding the same .
and I have one more query ,i.e. how to click on the contents on GUI when working with robot framework
Thanks in advance

I think the only way you can get such an error message is if you mix two styles of cell separators in your test. For example, you may be mixing tabs and pipes, or multiple spaces and pipes.
Robot determines which format to use on a line-by line basis. First, it looks for a tab anywhere in the line being parsed, and if it finds it, it uses tabs to split the line. If it doesn't find a tab, it checks to see if the line begins with a pipe and space. If so, it uses the pipe for a separator. Failing that, it uses multiple spaces as the separator.
I can reproduce the exact error you are getting by mixing pipes with either a tab or multiple spaces. For example, the following will generate the exact same error you report:
# the next line begins with two spaces
click element | id=treeview_tv_active
Robot will detect the two leading spaces and decide to use spaces to split the line into cells. Thus, the first cell will be "click element" and the second cell will be "| id=treeview_tv_active". Selenium looks for everything before the "=" as the locator type, thus it's using "| id" as the locator, which is invalid and results in the error that you see.
Since you haven't shown us your code it's impossible to say for sure, but my guess is that the line causing the problem begins with a space or tab, or has a tab embedded somewhere else in the line, but later in the same line attempts to use pipes as cell separators.

Related

How to resolve this error "No keyword with name 'and' found"

When I execute this keyword, 'No keyword with name 'and' found error is displayed.
Test this keyword
[arguments] ${YearDiff} ${MonthDiff}
Run Keyword If ${YearDiff}>=0 and ${MonthDiff}>=0 Click Element id=Left_Calendar_Icon
Run Keyword If ${YearDiff}<=0 and ${MonthDiff}<=0 Click Element id=Right_Calendar_Icon
Correct me if i have used wrong syntax.
You are using the space-separated format, which means that robot uses two or more spaces to separate keywords. You have two spaces on each side of "and" so robot thinks "and" is a keyword. The entire expression needs to fit in a single cell of the test case table.
The solution is to put only one space on each side of "and":
Run Keyword If ${YearDiff}>=0 and ${MonthDiff}>=0 Click Element id=Left_Calendar_Icon

How to find start and end of IF THEN ELSE block in asp classic

I have been tasked to edit some classic asp pages(though I develop in C#). These were created 10 years back but are still in use. One of the file is very big spanning 5159 lines. It has got many nested if then conditions which I am unable to figure out .. which is this if , where it is starting or where next if is like that.
I have tried vs2010 but it also dosen't highlight start/end of if/else, I tried notepad++ also with the same story.
My question to asp developers is that which IDE they use or how they figure out the start of many nested ifs thens?
I like to use UltraEdit Professional Text/HEX Editor which can fold unfold blocks: http://www.ultraedit.com/
Also this could help: http://www.aspindent.com/?indent
Never used it but heared good things about it: http://www.aspdebugger.com/
A code folding feature is very helpful on such problems, but only if code is quite good formatted. But code folding is of no help if the nesting takes place within a line.
All IDE and most text editors have a Match Brace command or something similar. That command is usually best to find the matching brace of a condition in a not well formatted block with nested conditions.
UltraEdit and maybe also other text editors support even customizable strings which are applied to the Match Brace feature. Perhaps this is a help for you on the not well structured ASP code.
UltraEdit has several brace matching features. But for your problem the most helpful would be the commands Go to Matching Brace and Select to Matching Brace which are both in menu Search (traditional menus) respectively Go to brace and Select to brace on Codding tab/menu (ribbon mode/contemporary menus). With caret blinking at beginning of an If the first command moves caret to the matching End If and the second command additionally selects everything from If to End If. The commands can be used also in reverse direction from End If to matching If.
But before the brace matching commands can be used on your ASP files on If and End If, it is necessary to define the string If as opening brace and the string End If as closing brace in the syntax highlighting wordfile for ASP.
To do this open in UltraEdit from ribbon/menu Advanced the Configuration by clicking on Configuration (traditional menus) or Settings (ribbon mode/contemporary menus). Open in configuration tree Editor Display and click on Syntax Highlighting. Select the language respectively wordfile VBScript ASP and click on button Open. Exit the configuration dialog with button Cancel.
In the opened wordfile vbscript.uew search at top for the lines
/Open Brace Strings = "{" "(" "[" "<"
/Close Brace Strings = "}" ")" "]" ">"
and append on first line "If" and on second line "End If".
/Open Brace Strings = "{" "(" "[" "<" "If"
/Close Brace Strings = "}" ")" "]" ">" "End If"
Save the modified wordfile and close it. The modification is immediately active and you can use now the commands Go to Matching Brace and Select to Matching Brace in your ASP files.

inserting line breaks after every record in the textpad

I have a textpad file that has rows of text. For e.g.
Cat: Meaning - animal. The cat ran up the house
Rat: Meaning- rodent. The rat lives in the borough and feeds on leftovers
Word 3: Description
Word 4: Description
I have many such record in my file. I want to insert a line break at the end of every record for proper presentation. Doing it manually is tedious. Please help if you know an automated process to insert line break.
You can quickly do this by using a feature called "Regular Expressions" to find and add empty lines.
Open up the Find/Replace (Search menu > Replace)
In the "Find what" field, type the following: (^.+$)\n(^.+$)
In the "Replace with" field, type the following: \1\n\n\2
Tick the "Regular expression" checkbox
Click the Replace All button at least twice, but perhaps 3 times, until you get the message Cannot find the Regular Expression
Untick the "Regular expression" checkbox
Close the Replace dialog
Confirm the file is formatted as you are expecting
Save the file.
You can write a simple C# prgram that uses a loop that adds this code after every line :
But first add the namespace using System.Enviorment
Enviorment.NewLine;
If you have any more trouble i'll help with some code to get started
Open up the Find/Replace (Search menu > Replace)
In the "Find what" field, type the following so that the replace occurs at the end of each line: $
In the "Replace with" field, type the following. Note each 'n' represents a <return>. In this instance, I added a return at the end of a SQL statement, the word 'GO' on the next line and another <return>: \n\GO\n
Started with text file containing:
select * from <tablename>
select * from <tablename>
Ended with text file containing:
select * from <tablename
GO
select * from <tablename>
GO
Hope that helps.
from your text it is difficult to understand what you are intending to do. I'll give you some questions. The answers will help others to help you.
Do you really mean textpad as the product from company helios in UK or do you use this word as a general word for a class of tools (like notepad - but there is a general definition AND the tool as part of Windows).
Your file hase line breaks yet. You don't see them, but in the file itself they are present (in Unix systems line feed (hex code 0A) or in the windows world carriage return followed by line feed (hex code 0D 0A)).
Or would you like to publish your text in HTML? So you have to put the necessary tags around each line like paragraph, line break, list item etc.?

Aptana: find and replace tabs (with spaces)

I am belatedly setting up Aptana to use four spaces instead of tabs. I've made the necessary changes to the preferences so every new tab inserts four spaces.
All the existing tabs remain, however, and so I get Mixed spaces and tab errors. How can you do a Replace all to fix this? I've tried ^t, <TAB> etc but it just searches for these as normal strings. What are the correct ways to specify a space and a tab?
I've found myself in similar situation and copying whole source code and repasting it helped me out. Just do as follow on your source code Ctrl+A, Ctrl+C, then Del whole code and Ctrl+V it again. You will get only spaces if have set it in options like you mentioned above.
There's an option in the refactor source menu to convert between tabs and space-tabs.
This worked for me: Edit > Find/Replace... (CTRL+F), check Regular Expressions, type \t and type 4 spaces (I use 4 spaces for tab).

Biztalk Flat File--Ignoring Headers and Footers

I believe I have a general understanding on the steps on how to do this, but am struggling to get the schemas correct, either using the Flat File Schema Generator or tweaking the config afterwords.
I will give a sample of the data below, but in general, it starts with a multi-line header that can have variable text but always ends with the same exact line ("START-OF-DATA"). The next section consists of rows of delimited data (this is the only part of the file I need to bring into Biztalk). Finally, there is a multi-line footer that always has the same start end end line ("END-OF-Data" and "END-OF-FILE").
Sample--my comments are in parens:
START-OF-FILE (this is always here)
(. . . variable number of lines that contain info I don't need . . .)
START-OF-DATA (this is always here)
(many lines of delimited data that I DO need)
END-OF-DATA (this is always here)
(. . . variable number of lines that contain info I don't need . . .)
END-OF-FILE (this is always here)
I have used the flat file generator to create three schema (header/detail/footer) with the intent to map only the detail. I created a pipeline and assigned the three schemas to the disassembly stage.
I am looking for general tips on what may be wrong with my approach, or what I should be looking out for. However the error I get when running this is:
The trailer specification specified on the pipeline component
properties does not contain an interchange trailer.
I have googled this error and (as suggested) tried to change the Child order from Infix to Postfix, but this didn't help.
I think this blog should help you:
http://maddcoder.wordpress.com/2012/06/14/using-biztalk-to-parse-a-flatfile-with-multi-line-header-and-trailers/

Resources