How to select the Chrome context menu option in Ranorex
File: SelectContextMenuOption.UserCode.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Threading;
using WinForms = System.Windows.Forms;

using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Repository;
using Ranorex.Core.Testing;
using System.Diagnostics;

namespace GlobalProjects
{
    public partial class SelectContextMenuOption
    {
        private void Init()
        {
            KodingwindowLogin();
        }

        public void KodingwindowLogin()
        {
            Process.Start("chrome.exe","https://kodingwindow.com/testapp/");
            repo.Kodingwindow.Username.Value = "kodingwindow";
            repo.Kodingwindow.Username.Click();
            repo.Kodingwindow.Username.DoubleClick();
            
            Mouse.Click(WinForms.MouseButtons.Right);
            Delay.Duration(200);

            foreach(MenuItem mi in repo.MenuBar.Items)
            {
                Report.Info(mi.Text);
            }
            
            foreach(MenuItem mi in repo.MenuBar.Items)
            {
                if(mi.Text.Equals("Copy Ctrl+C"))
                {
                    mi.EnsureVisible();
                    mi.MoveTo();
                    mi.Click();
                    break;
                }
            }
            
            repo.Kodingwindow.Password.PressKeys("{LControlKey down}{Vkey}{LControlKey up}");
            Delay.Duration(100);
            repo.Kodingwindow.Login.Click();
        }
    }
}
Advertisement