Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Clicking listgrid row/col from Selenium test

    I am using version SmartClient_SC_SNAPSHOT-2010-11-03_LGPL nightly build.

    I am using this because version 7 SmartClient doesn't support Selenium.

    For my testing I am obtaining sclocator information using FF 3.6.12 + Selenium IDE 1.0.7

    When I click on a cell in my listGrid the sclocator information that Selenium gives is as follows (I have added line breaks for clarity)

    Code:
    scLocator=
    /autoID[Class=PLSApplication||index=9||length=21||classIndex=0||classLength=1]
    /member[Class=PLSApplicationTabs||index=1||length=3||classIndex=0||classLength=1]/paneContainer
    /member[Class=PLSApplicationPane||index=0||length=2||classIndex=0||classLength=2]
    /member[Class=HLayout||index=1||length=2||classIndex=1||classLength=2]
    /member[Class=PLSContent||index=1||length=2||classIndex=0||classLength=1]
    /member[Class=DVTemplateLandingPage||index=4||length=5||classIndex=0||classLength=1]
    /child[Class=DVTemplateList||index=0||length=2||classIndex=0||classLength=1||roleIndex=0||roleLength=1||title=Templates||scRole=dialog]
    /item[0][Class="VLayout"]
    /member[Class=ListGrid||index=1||length=2||classIndex=0||classLength=1||roleIndex=0||roleLength=1||scRole=list]
    /body
    /row[id=9999||name=PageOptionsTest||1]
    /col[fieldName=name||1]
    This should click on row 1 and column 1.

    When I re-run the recorded click on this sclocator I get the following error from the Selenium IDE

    Code:
    [error] locator not found: ...*locator removed for clarity*..., error = TypeError: elem is null
    ...and looking at the last entries in the SmartClient developer console seem to indicate that only the listgrid has been found (not the table row/col elements):

    Code:
    INFO:AutoTest:Locator string:autoID[Class=PLSApplication||index=9||length=21||classIndex=0||classLength=1] - returning widget with matching ClassName / index by ClassName:[PLSApplication ID:isc_PLSApplication_0]
    INFO:AutoTest:Locator string:member[Class=PLSApplicationTabs||index=1||length=3||classIndex=0||classLength=1] - returning widget with matching ClassName / index by ClassName:[PLSApplicationTabs ID:isc_PLSApplicationTabs_0]
    INFO:AutoTest:Locator string:member[Class=PLSApplicationPane||index=0||length=2||classIndex=0||classLength=2] - returning widget with matching ClassName / index by ClassName:[PLSApplicationPane ID:isc_PLSApplicationPane_0]
    INFO:AutoTest:Locator string:member[Class=HLayout||index=1||length=2||classIndex=1||classLength=2] - returning widget with matching ClassName / index by ClassName:[HLayout ID:isc_HLayout_1]
    INFO:AutoTest:Locator string:member[Class=PLSContent||index=1||length=2||classIndex=0||classLength=1] - returning widget with matching ClassName / index by ClassName:[PLSContent ID:isc_PLSContent_0]
    INFO:AutoTest:Locator string:member[Class=DVTemplateLandingPage||index=4||length=5||classIndex=0||classLength=1] - returning widget with matching ClassName / index by ClassName:[DVTemplateLandingPage ID:isc_DVTemplateLandingPage_0]
    DEBUG:AutoTest:Locator string:child[Class=DVTemplateList||index=0||length=2||classIndex=0||classLength=1||roleIndex=0||roleLength=1||title=Templates||scRole=dialog] - returning widget with matching title and ClassName:[DVTemplateList ID:isc_DVTemplateList_0]
    WARN:AutoTest:Locator string:item[0][Class="VLayout"] matching by index gave [VLayout ID:isc_VLayout_0]. Reliability cannot be guaranteed for matching by index if the underlying application undergoes any changes.
    INFO:AutoTest:Locator string:member[Class=ListGrid||index=1||length=2||classIndex=0||classLength=1||roleIndex=0||roleLength=1||scRole=list] - returning widget with matching ClassName / index by ClassName:[ListGrid ID:isc_ListGrid_0]
    I had a go at changing the /row and /col parts so they use indexes

    (i.e. /body/row[1]/col[1])

    which worked!! But this is not acceptable because the cell I want to click isn't going to be in position 1,1 every time I run the test.

    Would it be possible to either obtain a copy of the uncompressed AutoTest class to help me debug the problem OR can anybody suggest why this might be happening.

    Regards
    Alex

    #2
    Can you post the code of the ListGrid sample where you say that the scLocator does not work?

    Comment


      #3
      Code:
      this.templateGrid = isc.ListGrid.create({
      	autoFitData: "horizontal",
      	width: "100%",
      	height: "100%",
      	sortField: "modifiedDate",
      	sortDirection: "Array.DESCENDING",
      	dataSource: dvTemplateDS,
      	alternateRecordStyles: true,
      	autoFetchData: false,
      	groupStartOpen: "none",
      	selectionType: "single",
      	dateFormatter: i18n("DATETIME_SHORT_DISPLAY_FORMAT", "toUSShortDateTime"),
      	fields:[
      		{name:"homePageIcon", title: " ", width: 25, type:"image", canGroupBy: false},
      		{name:"id", title:i18n("TEMPLATE_ID"), width:40, type:"integer", canGroupBy: false},
      		{name:"name", title:i18n("TEMPLATE_NAME_SHORT"), width: "*",
      			recordClick: function(viewer, record, recordNum, field, fieldNum, value, rawValue) {
      				me.templateGrid.runTemplate(record.id);
      				return false;
      			}
      		   },
      		{name:"createdBy",         title:i18n("TEMPLATE_CREATED_BY"), width:110},
      		{name:"createdDate",    title:i18n("TEMPLATE_CREATED_DATE"), width:130, type:"date"},
      		{name:"modifiedBy",        title:i18n("TEMPLATE_MODIFIED_BY"), width:110},
      		{name:"modifiedDate",    title:i18n("TEMPLATE_MODIFIED_DATE"), width:130, type:"date"}
      	],
      	getBaseStyle: function(record, rowNum, colNum) {
      		var cellStyle = this.Super("getBaseStyle", arguments);
      		if (this.getFieldName(colNum) === "name") {
      			return  "linkCell";
      		} else {
      			return cellStyle;
      		}
      	},
      	recordDoubleClick: function(viewer, record, recordNum, field, fieldNum, value, rawValue) {
      		me.templateGrid.runTemplate(record.id);
      	},
      	selectionChanged: function(record, state) {
      		if (state === true) {
      			me.editButton.setDisabled(false);
      			me.runButton.setDisabled(false);
      			me.viewButton.setDisabled(false);
      		} else {
      			me.editButton.setDisabled(true);
      			me.runButton.setDisabled(true);
      			me.viewButton.setDisabled(true);
      		}
      	}
      });

      Comment


        #4
        Hi abrown,

        Thanks for posting that, but that's not code we can run (has external dependencies).

        Comment

        Working...
        X