private void StartRecordingMethod(TranscriptCmdletBase cmdlet) { // UiaHelper.ProcessingTranscript(cmdlet); Global.GTranscript = true; int counter = 0; cmdlet.OddRootElement = // 20131109 //System.Windows.Automation.AutomationElement.RootElement; UiElement.RootElement; cmdlet.StartDate = DateTime.Now; do { //Application.DoEvents(); // 20131107 counter++; // bool res = // 20131114 //UiaHelper.ProcessingTranscriptOnce(cmdlet, counter); UiaHelper.ProcessingTranscriptOnce(cmdlet, counter, System.Windows.Forms.Cursor.Position); if (!res) { break; } } while (Global.GTranscript); }
public void StopRecording(TranscriptCmdletBase cmdlet) { cmdlet.WriteVerbose(cmdlet, "exit recording"); SeHelper.ExecuteJavaScript(cmdlet, (new OpenQA.Selenium.IWebDriver[] { CurrentData.CurrentWebDriver }), JsRecorder.ConstRecorderExitRecording, (new string[] { string.Empty }), false); cmdlet.WriteVerbose(cmdlet, "exited"); }
private void generateSequence( TranscriptCmdletBase cmdlet, System.Collections.Generic.List <IRecordedCodeSequence> recordingsCollection, IRecordedCodeSequence codeSequence, IWebElement firstElement, IWebElement secondElement) { Recorder.RecordingCollection = recordingsCollection; codeSequence = Recorder.RecordCodeSequence( cmdlet, Recorder.RecordingCollection, firstElement, codeSequence); if (null != secondElement) { codeSequence = Recorder.RecordCodeSequence( cmdlet, Recorder.RecordingCollection, secondElement, codeSequence); } Recorder.StoreCodeSequenceInCollection( cmdlet, Recorder.RecordingCollection, codeSequence); }
public RecorderForm(TranscriptCmdletBase cmdlet) { this.Cmdlet = cmdlet; // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // }
public RecorderForm(TranscriptCmdletBase cmdlet) { Cmdlet = cmdlet; // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // }
private void runRecordActions(List <object> listOfItems) { IWebDriver webDriver = new FakeWebDriver(); CurrentData.CurrentWebDriver = webDriver; var cmdlet = new TranscriptCmdletBase(); cmdlet.Timeout = 10; IJsRecorder recorder = new FakeJSGenerator(listOfItems); Recorder.RecordActions(cmdlet, recorder, cmdlet.Language); }
public void CheckCodeSequenceNovelty_RecordingCollection_Null_CodeSequence_Empty() { bool result = false; bool expectedResult = false; TranscriptCmdletBase cmdlet = new TranscriptCmdletBase(); Recorder.RecordingCollection = null; IRecordedCodeSequence codeSequence = new RecordedCodeSequence(); result = Recorder.CheckCodeSequenceNovelty( cmdlet, Recorder.RecordingCollection, codeSequence); Assert.AreEqual(expectedResult, result); }
public void MakeJsInjection(TranscriptCmdletBase cmdlet) { try { cmdlet.WriteVerbose(cmdlet, "checking injection"); var result = SeHelper.ExecuteJavaScript(cmdlet, (new OpenQA.Selenium.IWebDriver[] { CurrentData.CurrentWebDriver }), JsRecorder.ConstRecorderCheckInjection, (new string[] { string.Empty }), false); if (result) { cmdlet.WriteVerbose(cmdlet, "inserting injection"); SeHelper.ExecuteJavaScript(cmdlet, (new OpenQA.Selenium.IWebDriver[] { CurrentData.CurrentWebDriver }), JsRecorder.ConstRecorderInjectScript, (new string[] { Preferences.TranscriptExcludeList }), false); cmdlet.WriteVerbose(cmdlet, "injection inserted"); } } catch (Exception eGetInjectionCode) { cmdlet.WriteVerbose(cmdlet, "test for existing injection: " + eGetInjectionCode.Message); } }
public void CheckCodeSequenceNovelty_CodeSequence_Null() { bool result = false; bool expectedResult = false; TranscriptCmdletBase cmdlet = new TranscriptCmdletBase(); Recorder.RecordingCollection = new System.Collections.Generic.List <IRecordedCodeSequence>(); IRecordedCodeSequence codeSequence = null; result = Recorder.CheckCodeSequenceNovelty( cmdlet, Recorder.RecordingCollection, codeSequence); Assert.AreEqual(expectedResult, result); }
private void startSpying_Selenium() { TranscriptCmdletBase cmdlet = new TranscriptCmdletBase(); cmdlet.PassThru = false; cmdlet.Wait = true; cmdlet.Seconds = 60 * 60 * 24; Recorder.RecordActions(cmdlet, (new JsRecorder()), cmdlet.Language); // // // write result to a file // // }
public void CheckCodeSequenceNovelty_RecordingCollection_Empty_CodeSequence_Non_Empty() { bool result = false; bool expectedResult = true; TranscriptCmdletBase cmdlet = new TranscriptCmdletBase(); Recorder.RecordingCollection = new System.Collections.Generic.List <IRecordedCodeSequence>(); IRecordedCodeSequence codeSequence = new RecordedCodeSequence(); codeSequence.Items.Add((new RecordedAction())); result = Recorder.CheckCodeSequenceNovelty( cmdlet, Recorder.RecordingCollection, codeSequence); Assert.AreEqual(expectedResult, result); }
private void StartRecordingMethod(TranscriptCmdletBase cmdlet) { // UiaHelper.ProcessingTranscript(cmdlet); Global.GTranscript = true; int counter = 0; cmdlet.OddRootElement = // 20131109 //System.Windows.Automation.AutomationElement.RootElement; UiElement.RootElement; cmdlet.StartDate = DateTime.Now; do{ Application.DoEvents(); // 20131107 counter++; // bool res = // 20131114 //UiaHelper.ProcessingTranscriptOnce(cmdlet, counter); UiaHelper.ProcessingTranscriptOnce(cmdlet, counter, Cursor.Position); if (!res) break; } while (Global.GTranscript); }
public void CheckCodeSequenceNovelty_CodeSequence_Duplicated() { bool result = false; bool expectedResult = false; TranscriptCmdletBase cmdlet = new TranscriptCmdletBase(); Recorder.RecordingCollection = new System.Collections.Generic.List <IRecordedCodeSequence>(); IRecordedCodeSequence codeSequence = new RecordedCodeSequence(); RecordedWebElement webElement = new RecordedWebElement(); webElement.TagName = "button"; codeSequence.Items.Add(webElement); RecordedAction action = new RecordedAction(); action.UserData.Add("code", Recorder.CodeGenElementClick); codeSequence.Items.Add(action); Recorder.RecordingCollection.Add(codeSequence); // a new code sequence codeSequence = new RecordedCodeSequence(); webElement = new RecordedWebElement(); webElement.TagName = "button"; codeSequence.Items.Add(webElement); action = new RecordedAction(); action.UserData.Add("code", Recorder.CodeGenElementClick); codeSequence.Items.Add(action); result = Recorder.CheckCodeSequenceNovelty( cmdlet, Recorder.RecordingCollection, codeSequence); Assert.AreEqual(expectedResult, result); }
public void CleanRecordedDuringSleep(TranscriptCmdletBase cmdlet) { cmdlet.WriteVerbose(cmdlet, "cleaning colelcted during the sleep"); SeHelper.ExecuteJavaScript(cmdlet, (new OpenQA.Selenium.IWebDriver[] { CurrentData.CurrentWebDriver }), JsRecorder.ConstRecorderCleanRecordings, (new string[] { string.Empty }), false); cmdlet.WriteVerbose(cmdlet, "cleaned"); }
private void stopRecording(TranscriptCmdletBase cmdlet) { Global.GTranscript = false; //System.Windows.Forms.MessageBox.Show("Stopped!"); this.Cmdlet.StopProcessing(); }
private void startRecording(TranscriptCmdletBase cmdlet) { // UIAHelper.ProcessingTranscript(cmdlet); Global.GTranscript = true; int counter = 0; cmdlet.rootElement = System.Windows.Automation.AutomationElement.RootElement; cmdlet.startDate = System.DateTime.Now; do{ Application.DoEvents(); bool res = UIAHelper.ProcessingTranscriptOnce(cmdlet, counter); if (!res) break; } while (Global.GTranscript); }
private void pauseRecording(TranscriptCmdletBase cmdlet) { this.Cmdlet.Paused = true; //System.Windows.Forms.MessageBox.Show("Paused!"); }
public RecorderFrom(TranscriptCmdletBase cmdlet) { this.Cmdlet = cmdlet; InitializeComponent(); }
public RecorderFrom(TranscriptCmdletBase cmdlet) { Cmdlet = cmdlet; InitializeComponent(); }
private void PauseRecordingMethod(TranscriptCmdletBase cmdlet) { Cmdlet.Paused = true; //System.Windows.Forms.MessageBox.Show("Paused!"); }
private void StopRecordingMethod(TranscriptCmdletBase cmdlet) { Global.GTranscript = false; //System.Windows.Forms.MessageBox.Show("Stopped!"); Cmdlet.StopProcessing(); }
// 20131114 //this.getElementFromPoint(); // 20131210 // this.getElementFromPoint(Cursor.Position); // // use Windows forms mouse code instead of WPF // System.Drawing.Point mouse = System.Windows.Forms.Cursor.Position; // // // commented 20120618 to switch to UiaCOMWrapper // element = // System.Windows.Automation.AutomationElement.FromPoint( // new System.Windows.Point(mouse.X, mouse.Y)); // //element = // // //(UiaNET::System.Windows.Automation.AutomationElement) // // UiaCOM3.UiaCOMHelper.GetAutomationElementFromPoint(); // 20120618 UiaCOMWrapper // && (int)element.Current.ProcessId > 0) // if (element != null && ((element as AutomationElement) != null)) { // && (int)element.Current.ProcessId > 0) //if (element != null && ((element as UiaCOM::System.Windows.Automation.AutomationElement) != null)) { // && (int)element.Current.ProcessId > 0) // 20131210 // this.createTranscriptingCmdlet(); // as UiaNET::System.Windows.Automation.AutomationElement); // // this.richTextBox1.Text += // "failed to get element.Current.ProcessId\r\n"; // this.richTextBox1.Text += // "failed to get element.Cached.ProcessId\r\n"; // || // there is usually nothing to report // writing to the property grid control // writing to the family tree and the code //try { //} //catch (Exception eCollectAncestry) { // this.richTextBox1.Text = eCollectAncestry.Message; //} // the Hierarchy tree // the code generated // // 20131114 // // 20131210 // writingAvailablePatterns(element); // end of if (elementPID != tabooPID) // end of if (element != null && ((element as AutomationElement) != null)) // + public void ProcessSpyingCycle() //TranscriptCmdletBase cmdlet, IUiElement element) { do { Application.DoEvents(); try { // use Windows forms mouse code instead of WPF IUiElement element = ExSpyCode.GetElementFromPoint(Cursor.Position); if (null != element) { TranscriptCmdletBase cmdlet = ExSpyCode.CreateTranscriptingCmdlet(); try { bool res = UiaHelper.ProcessingElement(cmdlet, element); if (!res) { } } catch (Exception eProcessingElement) { txtFullCode.Text = "eProcessingElement element method:\r\n" + eProcessingElement.Message; element = null; System.Threading.Thread.Sleep(Preferences.TranscriptInterval); continue; } int elementPID = 0; try { // 20140312 // elementPID = element.Current.ProcessId; elementPID = element.GetCurrent().ProcessId; } catch { try { // 20140312 // elementPID = element.Cached.ProcessId; // elementPID = (element as ISupportsCached).Cached.ProcessId; elementPID = element.GetCached().ProcessId; } catch (Exception) { } } // 20131227 // int elementPID = UiaHelper.GetElementProcessIdSafely(element); if (elementPID != tabooPID) { if (cmdlet.LastRecordedItem.Count > 0) { try { richControlCode.Text = cmdlet.WritingRecord(cmdlet.LastRecordedItem, null, null, null); if (chkClipboard.Checked) { Clipboard.SetDataObject(richControlCode.Text); } } catch (Exception eCollectingElements) { txtFullCode.Text = "Collecting:\r\n" + eCollectingElements.Message; Exception eCollectingElements2 = new Exception("Collecting (eCollectingElements):\r\n" + eCollectingElements.Message); throw (eCollectingElements2); } guiWritingAutomationElementToPropertyGridControl(element); try { collectAncestry(ref ancestorsNodesList, ref ancestorsCodeList, element); guiFillHierarchyTree(); guiWriteCodeGenerated(); } catch (Exception eInner) { txtFullCode.Text += "Inner cycle (eInner):\r\n" + eInner.Message; } } richPatterns.Text = ExSpyCode.WritingAvailablePatterns(element); } } System.Threading.Thread.Sleep(Preferences.TranscriptInterval); } catch (Exception eUnknown) { txtFullCode.Text += "External cycle (eUnknown):\r\n" + eUnknown.Message; System.Threading.Thread.Sleep(Preferences.TranscriptInterval); } } while (!stopNow); }