private void highlightToolStripMenuItem_Click(object sender, EventArgs e) { try { if (controlsTree.SelectedNode != null) { if (controlsTree.SelectedNode.Tag is UIElement uiElement) { var element = UIElement.FromWPath(uiElement.ToWPath()); if (element != null) { var window = GetTopLevelWindow(uiElement.AutomationElement); if (window != null) { var iHandle = window.FrameworkAutomationElement.NativeWindowHandle; if (iHandle != IntPtr.Zero) { RobotWin32.BringWindowToFront(iHandle); var rect = element.GetRectangle(); if (rect != null) { InitializeRectangleForm(rect); } } } } } } } catch (Exception ex) { RobotMessageBox.Show(ex.Message, "Error"); } }
private void UnpackDrivers() { var unpackFolder = AbstractSettingsContainer.Instance.UserDocsAddonFolder.FullName; var embeddedResourceDictionary = new Dictionary <string, byte[]>() { { "chromedriver.exe", Resources.chromedriver }, { "geckodriver.exe", Resources.geckodriver }, { "IEDriverServer.exe", Resources.IEDriverServer } }; foreach (var embededResource in embeddedResourceDictionary.Where(e => !DoesFileExist(unpackFolder, e.Key) || !AreFilesOfTheSameLength(e.Value.Length, unpackFolder, e.Key))) { try { KillWorkingProcess(Path.GetFileNameWithoutExtension(embededResource.Key)); 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); } } }
public void Execute(Arguments arguments) { try { arguments.Search.Value = "/html/body/app-root/app-home/div[1]/app-header/div[1]/div[3]"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); arguments.Search.Value = "/html/body/app-root/app-home/div[1]/app-header/div[3]/p-sidebar/div/nav/div/label/button"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); arguments.Search.Value = "/html/body/app-root/app-home/div[2]/app-login/p-dialog/div/div[2]/div[2]/div/div[2]/div[2]/div[2]/form/div[1]/input"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); SeleniumManager.CurrentWrapper.TypeText(arguments.username.Value, arguments, arguments.Timeout.Value); arguments.Search.Value = "/html/body/app-root/app-home/div[2]/app-login/p-dialog/div/div[2]/div[2]/div/div[2]/div[2]/div[2]/form/div[2]/input"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); SeleniumManager.CurrentWrapper.TypeText(arguments.password.Value, arguments, arguments.Timeout.Value); Thread.Sleep(3000); RobotMessageBox.Show("Type the Captcha in below box"); } catch (Exception ex) { throw new ApplicationException($"Error occured while opening new selenium instance. Message: {ex.Message}", ex); } }
public void Execute(Arguments arguments) { arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.EditText"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.keyword.Value); RobotMessageBox.Show(arguments.message.Value); }
public void Execute(Arguments arguments) { RobotMessageBox.Show(arguments.message.Value); }
public void Execute(Arguments arguments) { RobotMessageBox.Show("Like posts"); arguments.Search.Value = "io.chingari.app:id/like_icon"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); }
public void Execute(Arguments arguments) { try { arguments.Search.Value = "/html/body/div[1]/div[2]/div/div[1]/div[2]/div[2]/div/ul[2]/li[5]/a"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); arguments.Search.Value = "/html/body/div[1]/div[3]/div[2]/div[2]/div/div[2]/div/form/div[1]/div/input"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); SeleniumManager.CurrentWrapper.TypeText(arguments.email.Value, arguments, arguments.Timeout.Value); arguments.Search.Value = "/html/body/div[1]/div[3]/div[2]/div[2]/div/div[2]/div/form/div[2]/div/div/input"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); 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); } }
// Implement this method public void Execute(Arguments arguments) { try { SeleniumWrapper wrapper = SeleniumManager.CreateWrapper( arguments.Type.Value, "https://zoom.us/", arguments.Timeout.Value, arguments.NoWait.Value, Scripter.Log, Scripter.Settings.UserDocsAddonFolder.FullName); int wrapperId = wrapper.Id; OnScriptEnd = () => { SeleniumManager.DisposeAllOpenedDrivers(); SeleniumManager.RemoveWrapper(wrapperId); SeleniumManager.CleanUp(); }; 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); } }
public void Execute(Arguments arguments) { arguments.Search.Value = "//android.view.ViewGroup[@content-desc='@{bottomNavigationBarButtonViewModel.contentDescription'])[1]/android.view.View"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "//android.widget.TextView[@content-desc='Add friends']"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "jp.naver.line.android:id / welcome_common_button"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "/ hierarchy / android.widget.FrameLayout / android.widget.FrameLayout / android.widget.FrameLayout / android.widget.LinearLayout / android.widget.ListView / android.widget.LinearLayout[1] / android.widget.Button"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "jp.naver.line.android:id / searchbar_input_text"; 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.name.Value); arguments.Search.Value = "jp.naver.line.android:id / common_bottom_first_button"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); RobotMessageBox.Show("Send the text and invite to LINE Android!"); }
public void Execute(Arguments arguments) { RobotMessageBox.Show("Comment on your favourite one on the current loop"); arguments.Search.Value = "io.chingari.app:id / comment_icon"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); }
public void Execute(Arguments arguments) { arguments.Search.Value = "com.microsoft.teams:id/welcome_sign_in_button"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "com.microsoft.teams:id / sign_in_another_account_button"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "com.microsoft.teams:id/edit_email"; 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.microsoft.teams:id / sign_in_button"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "i0118"; 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.password.Value); arguments.Search.Value = "idSIButton9"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); RobotMessageBox.Show("We hope you logged in without difficulties!"); }
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.FrameLayout/android.widget.RelativeLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.LinearLayout/android.widget.LinearLayout[1]"; 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/androidx.drawerlayout.widget.DrawerLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]"; 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.LinearLayout/android.widget.LinearLayout[1]/android.widget.RelativeLayout/android.widget.EditText"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.from.Value); arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout"; 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/androidx.drawerlayout.widget.DrawerLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.LinearLayout[3]"; 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.LinearLayout/android.widget.LinearLayout[1]/android.widget.RelativeLayout/android.widget.EditText"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.to.Value); arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout[1]/android.widget.LinearLayout/android.widget.LinearLayout"; 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/androidx.drawerlayout.widget.DrawerLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.TextView"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).Click(); }
public void Execute(Arguments arguments) { try { arguments.Search.Value = "/html/body/div[1]/div[1]/div[1]/div/div[1]/div[1]/div/div[1]/div/a[1]"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); arguments.Search.Value = "mobile"; arguments.By.Value = "id"; SeleniumManager.CurrentWrapper.TypeText(arguments.phoneno.Value, arguments, arguments.Timeout.Value); SeleniumManager.CurrentWrapper.PressKey("enter", arguments, arguments.Timeout.Value); Thread.Sleep(3000); RobotMessageBox.Show("Please enter the OTP generated on your phone "); 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); } }
// Implement this method public void Execute(Arguments arguments) { arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.TextView[2]"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).Click(); arguments.Search.Value = "//android.widget.LinearLayout[@content-desc='Choose an Account']/android.widget.LinearLayout/android.widget.Button"; 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.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.EditText"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.mobileno.Value); arguments.Search.Value = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.TextView[3]"; 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.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/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.FrameLayout/android.widget.FrameLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.Button[1]"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).Click(); }
public void Execute(Arguments arguments) { arguments.Search.Value = "jp.naver.line.android.registration:id / login"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "jp.naver.line.android.registration:id / auth_with_phone_number"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "jp.naver.line.android:id / common_dialog_cancel_btn"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "jp.naver.line.android:id/edit_text"; 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.phone.Value); arguments.Search.Value = "//android.widget.ImageButton[@content-desc='Next']"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "jp.naver.line.android:id / common_dialog_ok_btn"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); RobotMessageBox.Show("Login Successful"); }
public void Execute(Arguments arguments) { arguments.Search.Value = "//android.widget.Button[@content-desc='Search for people, jobs, posts, and more']/android.widget.TextView"; arguments.By.Value = "xpath"; ElementHelper.GetElement(arguments.By.Value, arguments.Search.Value).SendKeys(arguments.keyword.Value); RobotMessageBox.Show(arguments.message.Value); }
public void Execute(Arguments arguments) { RobotMessageBox.Show("Share through whatsapp "); arguments.Search.Value = "io.chingari.app:id / whatsapp_share"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); RobotMessageBox.Show("Send to the person you want to send"); }
public void Execute(Arguments arguments) { arguments.Search.Value = "com.cisco.webex.meetings:id/btn_my_pr_start_meeting"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "com.cisco.webex.meetings:id / warm_join_btn"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); RobotMessageBox.Show("Enjoy and Have a Productive Meeting Session!!"); }
internal void OpenAccessObject(AccessObjectModel report) { try { var app = GetCurrentApplication(); var name = report.FullName ?? report.Name; switch (report.Type) { case MSAccess.AcObjectType.acReport: app.DoCmd.OpenReport(name); break; case MSAccess.AcObjectType.acTable: app.DoCmd.OpenTable(name, MSAccess.AcView.acViewNormal, MSAccess.AcOpenDataMode.acReadOnly); break; case MSAccess.AcObjectType.acServerView: app.DoCmd.OpenView(name, MSAccess.AcView.acViewNormal, MSAccess.AcOpenDataMode.acReadOnly); break; case MSAccess.AcObjectType.acStoredProcedure: app.DoCmd.OpenStoredProcedure(name, MSAccess.AcView.acViewNormal, MSAccess.AcOpenDataMode.acReadOnly); break; case MSAccess.AcObjectType.acQuery: app.DoCmd.OpenQuery(name, MSAccess.AcView.acViewNormal, MSAccess.AcOpenDataMode.acReadOnly); break; case MSAccess.AcObjectType.acFunction: app.DoCmd.OpenFunction(name, MSAccess.AcView.acViewNormal, MSAccess.AcOpenDataMode.acReadOnly); break; case MSAccess.AcObjectType.acDiagram: app.DoCmd.OpenDiagram(name); break; case MSAccess.AcObjectType.acMacro: app.DoCmd.RunMacro(name, 1, true); break; default: throw new NotImplementedException($"Opener for {report.TypeName} not implemented."); } RobotWin32.BringWindowToFront((IntPtr)app.hWndAccessApp()); } catch (Exception ex) { RobotMessageBox.Show(ex.Message); } }
public void Execute(Arguments arguments) { RobotMessageBox.Show("Share through link command"); arguments.Search.Value = "io.chingari.app:id/external_share"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); arguments.Search.Value = "android:id/button2"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); RobotMessageBox.Show("Send to the person you want to send"); }
public void Execute(Arguments arguments) { RobotMessageBox.Show("This views all your recordings!"); arguments.Search.Value = "com.cisco.webex.meetings:id / btnRecording"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); Thread.Sleep(3000); RobotMessageBox.Show("View Past Recordings"); arguments.Search.Value = "com.cisco.webex.meetings:id / btnPast"; arguments.By.Value = "id"; ElementHelper.GetElement(arguments.By.Value.ToLower(), arguments.Search.Value).Click(); }
public void Execute(Arguments arguments) { try { SeleniumWrapper wrapper = SeleniumManager.CreateWrapper( "chrome", "https://secure.yatra.com/social/common/yatra/signin.htm", arguments.Timeout.Value, false, Scripter.Log, Scripter.Settings.UserDocsAddonFolder.FullName); int wrapperId = wrapper.Id; OnScriptEnd = () => { SeleniumManager.DisposeAllOpenedDrivers(); SeleniumManager.RemoveWrapper(wrapperId); SeleniumManager.CleanUp(); }; Thread.Sleep(20000); arguments.Search.Value = "/html/body/div[3]/div/section/div[1]/form/ul/li[1]/div/input"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); Thread.Sleep(2000); SeleniumManager.CurrentWrapper.TypeText(arguments.email.Value, arguments, arguments.Timeout.Value); Thread.Sleep(4000); arguments.Search.Value = "/html/body/div[3]/div/section/div[1]/form/ul/li[3]/button"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); Thread.Sleep(3000); arguments.Search.Value = "/html/body/div[3]/div/section/div[1]/form/ul/li[2]/input"; arguments.By.Value = "xpath"; SeleniumManager.CurrentWrapper.Click(arguments, arguments.Timeout.Value); Thread.Sleep(2000); SeleniumManager.CurrentWrapper.TypeText(arguments.pword.Value, arguments, arguments.Timeout.Value); Thread.Sleep(3000); SeleniumManager.CurrentWrapper.PressKey("enter", arguments, arguments.Timeout.Value); Thread.Sleep(2000); 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 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 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); } }