I'm using the Telerik Testing Tools. My goal is to wait for an anchor to make it to the screen, then click on it. The anchor has an href of #resources/details?mode=view&resourceId=149176
I'm having problems escaping that string properly. This code works perfectly:
ActiveBrowser.WaitForElement(5000, "href=~resourceId=149176")
.As<HtmlAnchor>().Click();
Unfortunately, when I try to incorporate more of the url, it breaks, ie, this does not work
ActiveBrowser.WaitForElement(5000, "href=~view&resourceId=149176")
.As<HtmlAnchor>().Click();
It seems as though the & is the problem. I've tried escaping it with everything I can think of based on Telerik's documentation on find expressions, including \ \' and =.
What is the proper way to escape this string?
I believe that you can use & for this one.
Related
I'm trying to use EmEditor to do some find and replace on HTML using regex. I know that Regex is not generally suitable for HTML parsing but I believe it will work for my limited requirement. I can't get it to do some fairly simple finds. e.g. find the head section and remove it. I've tried several different syntaxes e.g. <head.*?>(.|\n)*?</head> also simpler ones where there are no attributes e.g. <head>.*?</head>. None work. What am I doing wrong?
Please try a non-zero value to the Additional Lines to Search for Regular Expressions text box in the Advanced dialog box (Click the Advanced button in the Find dialog box) if you need to search for multi-line strings.
I know how to escape hash(#) symbol in kendo grid client template like this:-
\\#
But when I am trying to escape a hash in kendo nested grid it is not working probably because \# has special meaing in nested grid. But how can I escape it?
I tried \\\\#, \\#\\#,\\## but nothing worked. Has anyone faced such scenario?
You can make it work if you do
\\\\\\#
that is:
\\\\ is for the backslashes, because the template is treated as javascript, this will be truncated to \\. but for the reason that the # would also be interpreted as binding, you have to escape it separatley to \\#.
after the template is interpreted, the detailview will interpret \\# and your link or whatever you have that requires that escaping, will have the correct value.
I have just installed CK Editor onto a form that submits data to a database, when I want to use an apostrophe ' It is displaying as & #39; on my web page instead.
How can I get it to display an apostrophe instead?
What's happening is that somewhere along the line, CKEditor (or maybe another part of the system) is going through and converting characters that might potentially cause problems (due to having special meaning in HTML) into their HTML entity representations.
This is normal behaviour and if you don't need to do any string manipulation inside your database you can happily leave it as is for that stage. Indeed you can have them in along with normal HTML text and it should render just fine.
Clearly your setup is sufficiently different that something isn't happening. So, you'll want to use something like PHP's html_entity_decode() to convert back to normal unescaped text. There should be an equivalent function available in any language with a half-decent standard library.
Hi I am using Watir to click through some links. I go to a page, click a link based on its text, and the do it again click a new link. I am locating the links based on their text (it is the only way I can based on their HTML) and need to match the text I pulled from the page to the link. The text that I get contains some extra text not part of the link, so I need to gsub it out. Here is my issue:
String: text = "Nuclear Launch Codes (Levels One/Two)"
Link: Nuclear Launch Codes (Levels One/Two) Blah Blah Blah
Because the links do not always have the exact text I need to locate them like so: /#{text}/
Problem is that returns "Nuclear Launch Codes (Levels One\/Two)"
I though I would gsub the 1st parenthesis and everything after, but I need to keep it because I can have Nuclear Launch Codes (Levels Four/Five)
Is there anyway to modify the string to match the link while ignoring the rest of the link text?
If I understand you correctly, try:
/#{Regexp.escape(text)}/
Or equivalently, if you prefer:
Regexp.new(Regexp.escape(text))
This will automatically escape parentheses, slashes and so on in the text so they are not treated as special regexp characters.
So I have the Smarty TM bundle installed and active in Textmate, but I have a problem with the way it treats stuff inside of Smarty's literal tags.
As seen in this example: http://pastie.textmate.org/private/v3amipi5ukpg7vlcivixw
If I put Smarty literal tags inside of my HTML script tags, TM sees the stuff within the script tags as JS and highlights it appropriately. If I move those literal tags such that they are around my script, Textmate loses track of the fact that the script tags contain javascript--or even that the script tags are HTML--neither are highlighted.
I hate putting my literal tags inside the script because everything that deals with JS in the editor (for example, I have a TM command to run my JS through JSHint) gets mad at them being there unless I prefix them with JS comments (like in my pasted example). But prefixing them with comments is extra work I don't feel like doing, and causes lots of empty comments in my outputted source.
I have looked at the various lang definitions involved, and just cannot figure out what the heck to do to fix it. Any thoughts?
Thanks,
Jim