How can I use Turkish character with XPath's translate() function? - selenium

I need a select element by xpath with text. In this case it should be case-insensitive. I added Turkish characters (Ç,Ö,İ,Ş,Ü,Ğ) in translate() function but its not working. Same method working properly with English words.
/a[.=translate('seni çok seviyorum','abcçdefgğhıijklmnoöpqrsştuüvwxyz','ABCÇDEFGĞHIİJKLMNOÖPQRSŞTUÜVWXYZ')]
is there a solution to this?

Related

How to write an XPath to select text with a quote & comma character?

How can I select a XPath that contains a text with both quote & comma character?
I have to find an element if the text contains =Yes, It's OK
My XPath does not save in ranorex tool even though if i put the text inside the double quotes like below
//span[text()="Yes, It's OK"]
So how can I save this xpath that uses "".in Ranorex
your use of double-quotes is correct. if
//span[text()="Yes, It's OK"]
doesn't match, it might be because the xpath engine has a lowercase bug (i have encountered PHP+DOMXPath+libxml2 systems where it would only match lowercase text even for text with uppercase characters, never quite figured out the problem there), or it might be because the text has hidden whitespace you're not aware of, maybe it actually has a hard-to-spot whitespace at the start or the end? anyway maybe contains() will work:
//span[contains(text(),"Yes, It's OK"]
or.. if it has the lowercase-issue i have encountered in the wild once before, maybe this will work:
//span[contains(text(),"yes, it's ok"]
(that really shouldn't be required, but i have been in that situation once before, and that was years ago, and that was... probably php5)

What's the regular expression to replace (., space, -, ) in a string using Labview

I am trying to replace some unnecessary characters in a string in LabView. For example in the following string, "he llo-hOW-are.You?" I want to replace space, . and - with an Underscore _.
The output shall be "he_llo_hoW_are_You?"
I tried "[\ \.\-]" and many more things but nothing seem to work for a regular expression.
I am using Search and Replace function and I am putting the Regular expression in the Search String field.
Thanks.
Did you make sure to right click the function and check the Regular Expression option? The function won't work with regexes otherwise (as the help for it says).
This seems to work just fine here:
Make sure you set the Regular Expression in the "Search and Replace String" right click menu.
It should work with the regular expression you are trying to use. Or you can use [\ .-] in the Regex as well.
This logic will apply all special Characters.

Selenium IDE: Search for text using wildcard or how to escape '

How do I either search for a text using a wildcard or how do I escape the character '?
I have to find the text: Størrelser (Label 'size').
How do I do that using xpath?
I have tried different examples as:
//li[contains(text(),'Størrelser (Label 'size')')]
//li[starts-with(text(),'Størrelser')]
I need some help here :)
//li[contains(., "Størrelser (Label 'size')")]
This should do it for you. Normally the text value of 'Størrelser (Label 'size')' would be contained within single quotes as shown here, but because the actual value contains single quotes, you can switch them to doubles to avoid issues with it detecting where the xpath ends, the only option as xpath doesn't really contain a way to escape literals unfortunatley

Regex literal in Frege

What is an unicode code for grave accent mark used to specify regex literal in Frege?
The character is called Acute Accent and the unicode for that is 00B4. In ubuntu, you can type that using Ctrl+Shift+u and then type 00B4 then space. However you don't really have to use that if your regex literal is more than one character in which case you can just use apostrophes.
Quoting the doc:
Regular expression literals have type Regex and are written:
´\b(foo|bar)\b´ -- string enclosed in grave accents
'\w+' -- string with length > 1 enclosed in apostrophes
The notation with the apostrophes has been introduced because many have a hard time entering a grave accent mark on their terminal. However, it is not possible to write a regular expressions with length 1 this way, because then the literal gets interpreted as Char literal. (One can write something like '(?:X)' for a Regex that matches a single 'X').

Convert text with HTML character encoding to database characterset

Our application receives data from various sources. Some of these contain HTML character makeup instead of regular characters. So instead of string "â" we receive string "â".
How can we convert "â" to a character in the database character set using SQL/PLSQL?
Our database is 10GR2.
Unescape_reference and excape_reference I believe is what you're looking for
UTL_I18N.UNESCAPE_REFERENCE('hello < å')
This returns 'hello <'||chr(229).
http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/u_i18n.htm#i998992
You can use the CHR() function to convert an ascii character number to a character representation.
SELECT chr(226)
FROM dual;
CHR(226)
--------
â
For more information see: http://www.techonthenet.com/oracle/functions/chr.php
Hope it helps...
one solution
replace(your_test, 'â', chr(226))
but you'd have to nest many replace functions, one for each entity you need to replace. This might be very slow if you have to replace many.
You can wrote your own function, seqrching for the ampersand and replacing when found.
Have you searched the Oracle Supplied Packages manual? I know they have a function that does the opposite for a few entities.
to convert a column in oracle which contains HTML items to plain text, you could use:
trim(regexp_replace(UTL_I18N.unescape_reference(column_name), '<[^>]+>'))
It will replace HTML character as above stated but will also remove HTML tags en remove leading and trailing spaces.
I hope it will help someone.