Completed
Last Updated: 05 Oct 2018 08:11 by ADMIN
ADMIN
Elena
Created on: 03 Aug 2018 10:39
Type: Feature Request
1
AddEventListener() is not working in FF and Chrome
There is an exception when trying to add the event listener. The code is reused from this article - https://docs.telerik.com/teststudio/testing-framework/write-tests-in-code/advanced-topics-wtc/javascript-wtc/javascript-events#javascript-event-handlers

Expected: successful run

Actual: an exception is thrown. 

InnerException:
ArtOfTest.WebAii.Exceptions.ExecuteCommandException: ExecuteCommand failed!
InError set by the client. Client Error:
this.eventHandlers is undefined
BrowserCommand (Type:'Action',Info:'NotSet',Action:'AttachEventHandler',Target:'ElementId (tagName: 'input',occurrenceIndex: '5')',Data:'click--@@--21e26bef-07eb-4e5b-b383-3e91f4b50f9b',ClientId:'fa1e60f0-697c-4d4b-bda7-a0c37a473a96',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'this.eventHandlers is undefined')


3 comments
ADMIN
Ivaylo
Posted on: 05 Oct 2018 08:11
This behavior has been fixed, please install the latest extensions for Chrome and Firefox
Lisa
Posted on: 04 Oct 2018 16:35
So I'm guessing this didn't get fixed in the latest release... how can we make this get prioritized?
Renjila
Posted on: 23 Aug 2018 05:16
Hello,
I tried the mouseover event handling for a label as follows.
 private volatile bool _clickHandled;
        private System.Threading.AutoResetEvent _clickARE;

        private void OnMouseOver(object sender, ArtOfTest.WebAii.Javascript.JavascriptEventArgs e)
        {
            _clickHandled = true;
            _clickARE.Set();
            
        }
    
        [CodedStep(@"Invoke 'OnMouseOver' event on 'Customtext2262LabelElLabelTag'")]
        public void Monday_CodedStep32()
        {
            // Invoke 'OnMouseOver' event on 'Customtext2262LabelElLabelTag'
            System.Threading.Thread.Sleep(10000);

            ActiveBrowser.RefreshDomTree();
           _clickARE = new System.Threading.AutoResetEvent(false);
           _clickHandled = false;
           Pages.Https1013129.Customtext2262LabelElLabelTag.AddEventListener("mouseover",OnMouseOver);
           Pages.Https1013129.Customtext2262LabelElLabelTag.InvokeEvent(ArtOfTest.WebAii.Core.ScriptEventType.OnMouseOver);
           _clickARE.WaitOne(500);
            Assert.IsTrue(_clickHandled);
        }

This test fails for the Asset statement in internet explorer ,whereas it failed with the following exception in Chrome
InnerException:
ArtOfTest.WebAii.Exceptions.ExecuteCommandException: ExecuteCommand failed!
InError set by the client. Client Error:
Cannot set property '0636b0c0-647d-48d4-9da6-b5f159d692b8' of undefined
BrowserCommand (Type:'Action',Info:'NotSet',Action:'AttachEventHandler',Target:'ElementId (tagName: 'label',occurrenceIndex: '30')',Data:'mouseover--@@--0636b0c0-647d-48d4-9da6-b5f159d692b8',ClientId:'dc1337b2-50ee-474c-a3e1-3cf27e0d4332',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'Cannot set property '0636b0c0-647d-48d4-9da6-b5f159d692b8' of undefined')