示例#1
0
 void Event_OnMouseOver(TestObject sender, TestEventArgs e)
 {
     if (_isSupported)
     {
         if (!sender.Equals(_lastObj))
         {
             Thread t = new Thread(new ParameterizedThreadStart(SetText));
             t.Start(sender);
             _lastObj = sender;
         }
         else
         {
             IVisible v = sender as IVisible;
             v.HighLight(1000);
         }
     }
 }
示例#2
0
 void _dispatcher_OnClick(TestObject sender, TestEventArgs args)
 {
     throw new NotImplementedException();
 }
示例#3
0
 void Recorder_OnClick(TestObject sender, TestEventArgs args)
 {
     AddLog("Click on " + sender.ToString());
 }
        /*  void RegBrowserEvent()
        *  register IE event.
        */
        protected virtual void RegBrowserEvent(InternetExplorer ie)
        {
            object isRegistered = ie.GetProperty(TestConstants.IE_ALREADY_REGISTERED);
            if (isRegistered == null)
            {
                RegDownloadEvent(ie);
                RegWin32Event(ie);
                RegDocumentCompleteEvent(ie);
                RegNavigateEvent(ie);
                RegNewWindowEvent(ie);
                RegQuitEvent(ie);
                ie.PutProperty(TestConstants.IE_ALREADY_REGISTERED, true);

                if (OnBrowserAttached != null)
                {
                    TestEventArgs e = new TestEventArgs("Browser", ie);
                    OnBrowserAttached(this, e);
                }
            }
        }
        protected virtual ITestPage PageChange(int pageIndex)
        {
            if (pageIndex >= 0 && pageIndex < this._browserList.Count)
            {
                InternetExplorer ie = _browserList[pageIndex];
                try
                {
                    AttachBrowser(ie);
                    ActiveTab(pageIndex);

                    _currentPage = GetPage(pageIndex) as TestIEPage;

                    if (OnSelectPageChange != null)
                    {
                        TestEventArgs e = new TestEventArgs("PageIndex", pageIndex);
                        OnSelectPageChange(this, e);
                    }
                }
                catch (TestException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    throw new CannotAttachBrowserException(ex.ToString());
                }
            }

            return _currentPage;
        }
        protected virtual void OnBeforeNavigate2(object pDisp, ref object URL, ref object Flags, ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel)
        {
            try
            {
                if (_startTime == 0)
                {
                    _startTime = GetPerformanceTime();
                }

                string url = URL.ToString();
                if (!String.IsNullOrEmpty(url) && String.Compare(url, TestConstants.IE_BlankPage_Url, true) != 0)
                {
                    if (_isDownloading == false)
                    {
                        _isDownloading = true;
                        if (OnBrowserNavigate != null)
                        {
                            TestEventArgs tea = new TestEventArgs(TestConstants.PROPERTY_URL, url);
                            OnBrowserNavigate(this, tea);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new CannotAttachBrowserException("Error OnBeforeNavigate2: " + ex.ToString());
            }
        }