Skip to main content


Showing posts from 2010

Selenium - Regular Expressions, Dynamic Objects

Hi Guys,

I am using selenium RC with Visual Studio 2010 IDE  and created tests.
Also i am using Selenium RC with Eclipse...

Here i am listed out some ideas in identifying dynamic objects.
Take your Object id looks like "ctl00_MainEntry_AreaCreationControl_AreaGridView_ctl12_AreaNameFooterTextBox"
Here ctl12 is the part which is changing part based on which row / session...But you want to enter the value irrespective of row position..

Here you have to use regular expressions

//input[Contains(@id,'ctl00_MainEntry_AreaCreationControl_AreaGridView_ctl') and Contains(@id,'_AreaNameFooterTextBox')] //input[@id,RegExp:'ctl00_MainEntry_AreaCreationControl_AreaGridView_ctl??_AreaNameFooterTextBox'] //input[@id,glob:'ctl00_MainEntry_AreaCreationControl_AreaGridView_ctl*_AreaNameFooterTextBox'] //*@id,glob:'ctl00_MainEntry_AreaCreationControl_AreaGridView_ctl*_AreaNameFooterTextBox']
If all the above methods are not working for you, then try these...


Data Driven Test using Selenium for Beginners

Guys, Here I have mentioned some ideas about how to do data driven test in selenium tool with selenium RC libraries. Here is some sample code and you can pickup from here...
using System; using System.Text; using System.Collections.Generic; using System.Text.RegularExpressions; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting.Web; using System.Threading; using NUnit.Framework; using Selenium; using System.Data;