Hi,everybody!

Today I found something which I think is bug.
I have one select named as "a" in my html and I want to store its value in
my variant "tmpA".
Below is my scripts:
|storeAttribute|[EMAIL PROTECTED]|tmpA|
......
|select        |a      |${tmpA}|
I got an error with message "${tmpA} not found" when running these
scripts.After debugging selenium I found the reason was caused by the code
of below.
The last line of function "findAttribute" returned null because the value of
a was "", a empty string.

PageBot.prototype.findAttribute = function(locator) {
    // Split into locator + attributeName
    var attributePos = locator.lastIndexOf("@");
    var elementLocator = locator.slice(0, attributePos);
    var attributeName = locator.slice(attributePos + 1);

    // Find the element.
    var element = this.findElement(elementLocator);

    // Handle missing "class" attribute in IE.
    if (isIE && attributeName == "class") {
        attributeName = "className";
    }

    // Get the attribute value.
    var attributeValue = element.getAttribute(attributeName);

    return attributeValue ? attributeValue.toString() : null;
};

I think the return value should be "" not null and the code should be :
 return attributeValue || attributeValue == ""? attributeValue.toString() :
null;

Am I correct?

James

_______________________________________________
Selenium-devel mailing list
Selenium-devel@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-devel

Reply via email to