Ignore Case-sensitivity in selenium

5,829 views
Skip to first unread message

Kiran S

unread,
Oct 18, 2010, 2:54:47 PM10/18/10
to Selenium Users
Hi All,

I have a senario where in I'd like to ignore the case-sensitivity of
the text on the webpage and then check if it exists or not may be
using selenium.isTextPresent(). I tried using equalsIgnoreCase()
method from java, but couldn't achieve it. Could anybody suggest any
suitable logic to achieve this?

Thanks,
Kiran

OldGrantonian

unread,
Oct 18, 2010, 3:26:08 PM10/18/10
to Selenium Users
Your forum post begins:

Hi All

As an example, I can use the following command to find this text on
the forum page:

assertTextPresent | regexpi:hi all

Kiran S

unread,
Oct 19, 2010, 4:55:42 AM10/19/10
to Selenium Users
Thanks a lot Alan, regexpi worked.

Kiran

On Oct 19, 12:26 am, OldGrantonian <alandavids...@googlemail.com>
wrote:

Shaba K

unread,
Oct 19, 2010, 9:44:43 AM10/19/10
to seleniu...@googlegroups.com
isnt isTestPresent serving your purpose ??
 
-Shabana


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Kiran S

unread,
Oct 19, 2010, 1:25:20 PM10/19/10
to Selenium Users
Did you meant selenium.isTextPresent ?

On Oct 19, 6:44 pm, Shaba K <shabazi...@gmail.com> wrote:
> isnt isTestPresent serving your purpose ??
>
> -Shabana
>
>
>
> On Mon, Oct 18, 2010 at 7:54 PM, Kiran S <kshi...@gmail.com> wrote:
> > Hi All,
>
> > I have a senario where in I'd like to ignore the case-sensitivity of
> > the text on the webpage and then check if it exists or not may be
> > using selenium.isTextPresent(). I tried using equalsIgnoreCase()
> > method from java, but couldn't achieve it. Could anybody suggest any
> > suitable logic to achieve this?
>
> > Thanks,
> > Kiran
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Selenium Users" group.
> > To post to this group, send email to seleniu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > selenium-user...@googlegroups.com<selenium-users%2Bunsubscribe@go oglegroups.com>
> > .

Shaba K

unread,
Oct 20, 2010, 4:57:04 AM10/20/10
to seleniu...@googlegroups.com
yeah .. i meant the same :)

To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

Kiran S

unread,
Oct 20, 2010, 1:37:28 PM10/20/10
to Selenium Users
Cool :) selenium.isTextPresent served the purpose.

Kiran

Pavandeep Puddupakkam

unread,
Oct 20, 2010, 11:18:40 PM10/20/10
to Selenium Users
You can also use the VS Regular Expressions.
Assert.IsTrue(Regex.IsMatch(selenium.GetText(//div[@id='1'), "This is
testing example string", RegexOptions.IgnoreCase));

Kiran S

unread,
Oct 21, 2010, 6:39:31 AM10/21/10
to Selenium Users
Thanks Pavandeep. But I think I can't use this logic in selenium RC
with Java.

Kiran

On Oct 21, 8:18 am, Pavandeep Puddupakkam <puddupak...@gmail.com>
wrote:

Niraj Kumar

unread,
Oct 21, 2010, 6:50:46 AM10/21/10
to seleniu...@googlegroups.com
There is a way to verify the text present on web page ignoring case sensitiveness

http://automationtricks.blogspot.com/2010/10/how-to-verify-value-in-drop-down-list.html
Go to above URL there is a text on the page  " Using Xpath" 

use below command to verify text on the page

<tr>
    <td>verifyTextPresent</td>
    <td>regexpi:USING XPATH</td>
    <td></td>
</tr>

<tr>
    <td>verifyTextPresent</td>
    <td>regexpi:uSiNG XPath</td>
    <td></td>
</tr>

<tr>
    <td>verifyTextPresent</td>
    <td>regexpi:USING XPath</td>
    <td></td>
</tr>

<tr>
    <td>verifyTextPresent</td>
    <td>regexpi:using xpath</td>
    <td></td>
</tr>

same you can try in selenium RC to verify above text ignoring case sensitiveness

verifyTrue(selenium.isTextPresent("regexpi:USING XPATH"));
verifyTrue(selenium.isTextPresent("regexpi:uSiNG XPath"));
verifyTrue(selenium.isTextPresent("regexpi:USING XPath"));
verifyTrue(selenium.isTextPresent("regexpi:using xpath"));




--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.




--
Thanks & Regard,
Niraj Kumar

ravi teja

unread,
Sep 26, 2012, 5:55:22 AM9/26/12
to seleniu...@googlegroups.com
Hi Niraj,

Hi , I am having similar requirement , i need to click a checkbox , i will get the checkbox name dynamically during the program execution. I need to select the checkbox in the application ignoring case sensitivity , i have tried  

selenium.click("css=td[class='dxeListBoxItem dxeT']:contains("regexpi:"+str+"")");

but it is highlighting as error in eclipse . 

Please help me in solving this.

To describe breifly my requirement ,  during the flow of  program execution i will get the name of the checkbox to be selected in application i got the checkbox name as "Inactive" , i stored it in a string . when i passed this string variable to click in the main application it is throwing  error like element not found because in the application  .. the checkbox is named as "INACTIVE" . hence it is failing to  recognize it . how can i make it case insensitive so that it can identify the check box in any case. 

ThankS & Regards
Ravi Teja P.

Mike Riley

unread,
Oct 8, 2012, 4:15:49 PM10/8/12
to seleniu...@googlegroups.com
It is an error because you are trying to use double quotes inside your string.  Use single quotes inside any string and you won't have this problem.

Mike
Reply all
Reply to author
Forward
0 new messages