How to record the position in pixel with Selenium IDE

278 views
Skip to first unread message

Sandeep Neema

unread,
Mar 15, 2011, 6:30:12 AM3/15/11
to Selenium Users, s.n...@tcs.com
Had anyone ever tried to record the script with position(i.e. in
pixels) like 10,20 on web page instead of xpath or other normal things
like xpath ID, link etc..

I have got RFT scripts and i want to migrate this RFT scripts to
Selenium. I am looking for the feasibility of this migration.
Sample RFT looks like:



import resources.Script1Helper;


import com.rational.test.ft.*;

import com.rational.test.ft.object.interfaces.*;

import com.rational.test.ft.object.interfaces.SAP.*;

import com.rational.test.ft.object.interfaces.siebel.*;

import com.rational.test.ft.script.*;

import com.rational.test.ft.value.*;

import com.rational.test.ft.vp.*;



public class Script1 extends Script1Helper

{

public void testMain(Object[] args)

{



// Window: firefox.exe: Cruise Deals, Discount Cruises, and Cruise
Vacations – Carnival Cruise Lines - Mozilla Firefox

cruiseDealsDiscountCruisesAndC(ANY,MAY_EXIT).click(CLOSE_BUTTON);

startApp("http://www.carnival.com/");

selectForAnyMonthcomboBox().click(atPoint(141,4));

earlySaverwin().click(atPoint(48,215));

selectForAnyDestinationcomboBo().click(atPoint(140,9));

newtocruisinglink().click(atPoint(87,22));

selectForAnyDeparturePortcombo().click(atPoint(145,7));

selectForAnyMonthcomboBox().click(atPoint(101,0));

selectForAnyCruiseLengthcomboB().click(atPoint(144,5));

cruiseDealsDiscountCruisesAndC2().click(atPoint(278,620));

cruiseDealsDiscountCruisesAndC2().click(atPoint(1014,365));

searchbutton().click(atPoint(32,10));



// Window: firefox.exe: Mozilla Firefox

detailslink().click(atPoint(51,13));

selectlink().click(atPoint(69,16));

selectTheNumberOfTravelerscomb().click(atPoint(92,13));

linklink().click(atPoint(4,12));

selectTheNumberOfTravelerscomb().click(atPoint(90,17));

linklink().click(atPoint(11,10));

selectTheNumberOfTravelerscomb().click(atPoint(93,17));

linklink().click(atPoint(10,2));

linklink2().click(atPoint(68,14));

linklink2().click(atPoint(64,13));

linklink2().click(atPoint(59,14));

}

}

Thank you in advance..

mam_p

unread,
Mar 15, 2011, 11:59:40 AM3/15/11
to Selenium Users

I'm not sure why you're asking about how to *record* a script with
coordinates, given that you already have Java scripts that need
migrating. However, if you look at the Selenium 1.0 API doc (available
via a tiny link at the bottom of http://seleniumhq.org/), you'll see
that there are several calls which allow one to provide x/y
coordinates *relative* to the locator argument, including clickAt. And
it looks like the coordinates in your test script are also relative to
the object being clicked. FWTW! (For What That's Worth!)

--mam-p
Reply all
Reply to author
Forward
0 new messages