Running into error executing test in IE

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Running into error executing test in IE

GW-5
Hi

I'm using Selenium to try to automate webportal testing and recently ran into some problems running my tests in IE6.  Given what I'm testing, I'm using the gui_map extension as well as some self-written user extensions.  The command that continually fails (and blocks the rest of the test subsequently) is:

<tr>
        <td>setChecked</td>
        <td>uimap=cp.market_watch_left</td>
        <td>y</td>
</tr>

The locator is defined as:  //input[@name='selected_zone[1][]' and @value='stocks']
I've added the patch to html-xpath-patched.js to fix the issue with xpath in IE.

The setChecked command is defined as:
//takes y/n as second value.  sets item to appropriate checked status
Selenium.prototype.doSetChecked = function(locator, value) {
        var el = this.page().findElement(locator);
        var eltype = el.hasAttribute('type') ? el.getAttribute('type') : 'other';
        if(eltype !== 'checkbox') {
                Assert.fail(locator + ' is not a checkbox.');
        }
        var ischecked = el.hasAttribute('checked') ? el.getAttribute('checked') : false;

        if(ischecked){
                if(value === 'n'){
                        this.page().clickElement(el);
                }
        }
        else {
                if(value === 'y'){
                        this.page().clickElement(el);
                }
        }
}

Source for the element I'm attempting to perform the action on (when unchecked) is:

<input name="selected_zone[1][]" type="checkbox" value="stocks" /></td>

And the error message IE spits out is: Unexpected Exception: name -> TypeError, message -> Object doesn't support this property or method, number -> -2146827850, description -> Object doesn't support this property or method

This works perfectly in Firefox and I'm out of ideas for how to fix it.  Any help would be greatly appreciated.

Thanks,
Chris
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=1845&messageID=5242#5242

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Running into error executing test in IE

Alexandre Garel

Chris Nichols a écrit :
> Hi
>
> I'm using Selenium to try to automate webportal testing and recently ran into some problems running my tests in IE6.  Given what I'm testing, I'm using the gui_map extension as well as some self-written user extensions.  The command that continually fails (and blocks the rest of the test subsequently) is:
>
>  
Could you test this action :first :
        <td>testElementPresent</td>
        <td>uimap=cp.market_watch_left</td>
        <td>y</td>
just to see if the problem is in the locator or the command.
It seems to me that "and" are not well supported in IE xpath expression
(I don't know if the patch is supposed to fix that) see
http://forums.openqa.org/thread.jspa?threadID=1382&messageID=3953#3953.
If it is the problem you could try to write your locator so :
xpath=(//input[@name='selected_zone[1][]'])[@value='stocks']
Hope it helps
Alex






Ce message est protégé par les règles relatives au secret des correspondances. Il est donc établi à destination exclusive de son destinataire. Celui-ci peut donc contenir des informations confidentielles. La divulgation de ces informations est à ce titre rigoureusement interdite. Si vous avez reçu ce message par erreur, merci de le renvoyer à l'expéditeur dont l'adresse e-mail figure ci-dessus et de détruire le message ainsi que toute pièce jointe.

This message is protected by the secrecy of correspondence rules. Therefore, this message is intended solely for the attention of the addressee. This message may contain privileged or confidential information, as such the disclosure of these informations is strictly forbidden. If, by mistake, you have received this message, please return this message to the addressser whose e-mail address is written above and destroy this message and all files attached.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Running into error executing test in IE

GW-5
In reply to this post by GW-5
The problem turned out to be IE's DOM methods.  IE6 does not appear to support hasAttribute().  Using getAttribute() instead for IE allows the test to run without error.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=1845&messageID=5431#5431

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]