private void InstallAppiumWhenExceptionOccured(Exception ex) { if (ex.Message.StartsWith("Invalid")) { var result = RobotMessageBox.Show("It seems you have no Appium driver installed. Would you like to install it now?", "Error", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { Process.Start("\"C:\\Program Files\\nodejs\\npm.cmd\"", "install -g appium"); } } else { throw ex; } }
internal void ViewDataFromTable(string tableName) { try { var app = GetCurrentApplication(); var form = new DataTableForm(); using (var connection = new OleDbConnection(app.ADOConnectString)) { form.LoadData(connection, tableName); form.ShowDialog(); } } catch (Exception ex) { RobotMessageBox.Show($"Exception while loading data from {tableName}: {ex.Message}"); } }
public void Execute(Arguments arguments) { arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.drawerlayout.widget.DrawerLayout/android.widget.RelativeLayout/android.widget.LinearLayout[1]/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.TextView"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).Click(); arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.EditText"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.pin.Value); arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.LinearLayout/android.widget.EditText"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).Click(); RobotMessageBox.Show(arguments.message.Value); Thread.Sleep(10000); arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout[2]/android.widget.RelativeLayout/android.widget.TextView"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).Click(); }
public void InsertText(string textToBeInserted, int textPos) { if (textToBeInserted != "") { if (oShapes[textPos] != null) { PowerPoint.Shape oShape = oShapes[textPos]; PowerPoint.TextFrame oTxtFrame = oShape.TextFrame; PowerPoint.TextRange oTxtRange = oTxtFrame.TextRange; oTxtRange.Text = textToBeInserted; } else { RobotMessageBox.Show("There is no element to add your text to. Have you selected appropriate slide layout?"); } } }
internal void TryOpenFormFromSelectedNode(bool openInDesigner) { var selectedNode = controlsTree.SelectedNode; var model = (AccessObjectModel)selectedNode.Tag; var application = GetCurrentApplication(); new Thread(() => { try { OpenForm(model, openInDesigner, application); var newNode = GetLoadedFormNode(application, selectedNode.Text); controlsTree.FindForm().Invoke((MethodInvoker) delegate { ReplaceNode(selectedNode, newNode); }); } catch (COMException ex) { RobotMessageBox.Show(ex.Message); } }).Start(); }
private void OpenForm(AccessObjectModel formToLoad, bool openInDesigner, MSAccess.Application application) { try { var formName = formToLoad.FullName ?? formToLoad.Name; application.DoCmd.OpenForm( formName, openInDesigner ? MSAccess.AcFormView.acDesign : MSAccess.AcFormView.acNormal ); var form = application.Forms[formName]; form.SetFocus(); RobotWin32.BringWindowToFront((IntPtr)form.Hwnd); } catch (Exception ex) { RobotMessageBox.Show(ex.Message); } }
public void Execute(Arguments arguments) { arguments.Search.Value = "(//android.view.ViewGroup[@content-desc='@{bottomNavigationBarButtonViewModel.contentDescription'])[5]/android.widget.TextView"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "//android.widget.LinearLayout[@content-desc='People Nearby']/android.widget.RelativeLayout/android.widget.TextView"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "jp.naver.line.android:id / nearby_location_setting_btn"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "jp.naver.line.android:id / nearby_location_setting_btn"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); RobotMessageBox.Show("Enable Google Location Settings and then add people on LINE"); }
public void Execute(Arguments arguments) { var by = arguments.By.Value.ToLower(); if (by == "xy") { TouchAction clickAction = new TouchAction(OpenCommand.GetDriver()); var coordinates = arguments.Search.Value.Split(','); clickAction.Tap(int.Parse(coordinates[0]), int.Parse(coordinates[1])).Perform(); } else { ElementHelper.GetElement(by, arguments.Search.Value).Click(); } arguments.Search.Value = "com.google.android.youtube:id/search_edit_text"; arguments.By.Value = "Id"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.keyword.Value); RobotMessageBox.Show(arguments.message.Value); }
public void Execute(Arguments arguments) { try { SeleniumWrapper wrapper = SeleniumManager.CreateWrapper( "chrome", "https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin", arguments.Timeout.Value, false, Scripter.Log, Scripter.Settings.UserDocsAddonFolder.FullName); int wrapperId = wrapper.Id; OnScriptEnd = () => { SeleniumManager.DisposeAllOpenedDrivers(); SeleniumManager.RemoveWrapper(wrapperId); SeleniumManager.CleanUp(); }; arguments.Search.Value = "/html/body/div[1]/div[1]/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/form/span/section/div/div/div[1]/div/div[1]/div/div[1]/input"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.TypeText(arguments.email.Value, arguments, arguments.Timeout.Value); arguments.Search.Value = "/html/body/div[1]/div[1]/div[2]/div/div[2]/div/div/div[2]/div/div[2]/div/div[1]/div/div/button/div[2]"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); arguments.Search.Value = "password"; arguments.By.Value = "name"; SeleniumManager.CurrentWrapper.TypeText(arguments.pword.Value, arguments, arguments.Timeout.Value); arguments.Search.Value = "/html/body/div[1]/div[1]/div[2]/div/div[2]/div/div/div[2]/div/div[2]/div/div[1]/div/div/button/div[2]"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); RobotMessageBox.Show("Enter two step process if applicable"); } catch (Exception ex) { throw new ApplicationException($"Error occured while typing text to element. Text: '{arguments.email.Value}'. 'Search element phrase: '{arguments.By.Value}'.'{arguments.pword.Value}'. Message: {ex.Message}", ex); } }
public void Execute(Arguments arguments) { arguments.Search.Value = "com.medium.reader:id / sign_in_account_question_button"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "com.medium.reader:id / sign_in_email_prompt"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "com.medium.reader:id / email_login_email_input"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).SendKeys(arguments.email.Value); arguments.Search.Value = "com.medium.reader:id / email_login_button"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); RobotMessageBox.Show("Check your Email ID for further instructions to login Medium"); }
public void Execute(Arguments arguments) { try { SeleniumWrapper wrapper = SeleniumManager.CreateWrapper( "chrome", "linkedin.com", arguments.Timeout.Value, false, Scripter.Log, Scripter.Settings.UserDocsAddonFolder.FullName); int wrapperId = wrapper.Id; OnScriptEnd = () => { SeleniumManager.DisposeAllOpenedDrivers(); SeleniumManager.RemoveWrapper(wrapperId); SeleniumManager.CleanUp(); }; arguments.Search.Value = "/html/body/section/div[2]/div/section/div/div[1]/div/div/div/div/div[2]/a"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); arguments.Search.Value = "username"; arguments.By.Value = "id"; SeleniumManager.CurrentWrapper.TypeText(arguments.email.Value, arguments, arguments.Timeout.Value); arguments.Search.Value = "password"; arguments.By.Value = "id"; SeleniumManager.CurrentWrapper.TypeText(arguments.pword.Value, arguments, arguments.Timeout.Value); SeleniumManager.CurrentWrapper.PressKey("enter", arguments, arguments.Timeout.Value); var len = SeleniumManager.CurrentWrapper.RunScript("return document.getElementsByClassName(\"captcha -internal\").length"); if (len == "1") { RobotMessageBox.Show("Captcha detected, please solve the captcha"); } } catch (Exception ex) { throw new ApplicationException($"Error occured while opening new selenium instance. Message: {ex.Message}", ex); } }
private void UnpackDrivers() { var unpackFolder = AbstractSettingsContainer.Instance.UserDocsAddonFolder.FullName; var embeddedResourceDictionary = new Dictionary <string, byte[]>() { { "putty.exe", Resources.putty }, { "VNC.exe", Resources.VNC }, { "telnet.exe", Resources.telnet }, }; foreach (var embededResource in embeddedResourceDictionary.Where(e => !DoesFileExist(unpackFolder, e.Key) || !AreFilesOfTheSameLength(e.Value.Length, unpackFolder, e.Key))) { try { using (FileStream stream = File.Create(Path.Combine(unpackFolder, embededResource.Key))) { stream.Write(embededResource.Value, 0, embededResource.Value.Length); } } catch (Exception ex) { RobotMessageBox.Show(ex.Message); } } }
private void SelectUIElement(AutomationElement element) { if (element == null) { return; } var elements = wpathBuilder.GetAutomationElementsPath(element, AutomationSingleton.Automation.GetDesktop()); TreeNodeCollection nodes = controlsTree.Nodes; TreeNode foundNode = null; foreach (var el in elements) { foundNode = nodes.OfType <TreeNode>().FirstOrDefault(node => node.Tag.Equals(el)); if (foundNode == null) { RobotMessageBox.Show("Cannot find element"); return; } foundNode.Expand(); nodes = foundNode.Nodes; } controlsTree.SelectedNode = foundNode; }
public void Execute(Arguments argu) { RobotMessageBox.Show(argu.user.Value); }
public void Execute(Arguments argument) { RobotMessageBox.Show(argument.text.Value); }
public void Execute(Arguments arguments) { RobotMessageBox.Show(arguments.message.Value); }
public void InsertSlide(int slidePosition, string titleText, string slideText, string layout) { PowerPoint.PpSlideLayout slideLayout = PowerPoint.PpSlideLayout.ppLayoutTitle; switch (layout) { case "ContentWithCaption": slideLayout = PowerPoint.PpSlideLayout.ppLayoutTitle; break; case "TitleOnly": slideLayout = PowerPoint.PpSlideLayout.ppLayoutTitleOnly; break; case "Title": slideLayout = PowerPoint.PpSlideLayout.ppLayoutTitle; break; case "ObjectAndText": slideLayout = PowerPoint.PpSlideLayout.ppLayoutObjectAndText; break; case "Object": slideLayout = PowerPoint.PpSlideLayout.ppLayoutObject; break; default: slideLayout = PowerPoint.PpSlideLayout.ppLayoutObject; break; } if (slidePosition <= oSlides.Count + 1) { oSlide = oSlides.Add(slidePosition, slideLayout); } else { RobotMessageBox.Show("Your slide insert position is incorrect. Please check your number."); return; } oShapes = oSlide.Shapes; if (titleText != "") { PowerPoint.Shape oShape = oShapes[1]; PowerPoint.TextFrame oTxtFrame = oShape.TextFrame; PowerPoint.TextRange oTxtRange = oTxtFrame.TextRange; oTxtRange.Text = titleText; } if (slideText != "") { if (oShapes[2] != null) { PowerPoint.Shape oShape = oShapes[2]; PowerPoint.TextFrame oTxtFrame = oShape.TextFrame; PowerPoint.TextRange oTxtRange = oTxtFrame.TextRange; oTxtRange.Text = slideText; } else { RobotMessageBox.Show("There is no element to add your text to. Have you selected appropriate slide layout?"); } } }