Hi,

I have a user-extension that looks for the order of text in the page.
You could probably modify this for elements :

Selenium.prototype.assertTextOrder = function(textValues) {

    var allText = this.page().bodyText();
    var expectedTextValues = textValues.parseCSV();

    for (var i = 0; i < expectedTextValues.length - 1; i++) {
                var index = allText.indexOf(expectedTextValues[i]);
                var nextIndex = allText.indexOf(expectedTextValues[i+1]);
                if (index == -1) {
                assert.fail("'" + expectedTextValues[i] + "' not found.");
        }
                if (nextIndex == -1) {
                assert.fail("'" + expectedTextValues[i+1] + "' not found.");
        }

        if (index > nextIndex) {
                assert.fail("'" + expectedTextValues[i+1] + "' found before
'" + expectedTextValues[i] + "'");
        }
    }
}

Cheers,
Darren.

>






Hi,Rahul

Maybe you can descript your case in details.I think
an example will helpful.

James
- Show quoted text -
  ----- Original Message -----
  From:
  Rahul
  Chaturvedi
  To: selenium-users@lists.public.thoughtworks.org

  Sent: Monday, November 14, 2005 1$48
  PM
  Subject: [Selenium-users] Finding the
  order of occurence elements / text

  Hi,

  I need to compare two elements whether they are in the desired order or
  not. (which is coming first or which is on top)I thought of finding of the
  obj.offsetTop / obj.offsetLeft and storing them into some variables using
  store. then I need to compare both variables. How can I do this and if
  these are not elements just some text then also can it be done ....(how
  ?)

  Please suggest me a way to do this..
  Thanks for your help !!

  Rahul



  _______________________________________________Selenium-users
  mailing
  [EMAIL 
PROTECTED]://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

_______________________________________________Selenium-users mailing
[EMAIL 
PROTECTED]://lists.public.thoughtworks.org/mailman/listinfo/selenium-users
_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

Reply via email to