Ejemplo n.º 1
0
 private string ClickPath(AccessibilityHelper ah, GuiPath gpath)
 {
     //bool forAll = false;
     //bool clickParent = false;
     //AccessibilityHelper child;
     //if (m_for != null && "all" == (string)m_for) forAll = true;
     if (1 == m_logLevel)
         m_log.paragraph(makeNameTag() + "Click starting path from "" + ah.Role + ":" + ah.Name + """);
     ah = gpath.FindInGui(ah, this);
     if (ah != null)
     {
         if (1 == m_logLevel) m_log.paragraph(makeNameTag() + "Clicking last pair in path");
         int j;
         for (j = 0; j < m_repeat; j++)
         {  // click 10 pixels from the left edge - see below
             if (m_side == "right")
                 ah.SimulateRightClickRelative(m_dx, m_dy);
             else
                 ah.SimulateClickRelative(m_dx, m_dy);
             // when @wait="no" don't wait at all between repeated clicks
             if (m_wait) Thread.Sleep(400); // wait a while eg. let menus open, etc.
         }
         m_finished = true; // tell do-once it's done
     }
     else return m_message;
     return "";
 }
Ejemplo n.º 2
0
        /// <summary>
        /// method to apply when a non-terminal node has been found
        /// </summary>
        /// <param name="ah"></param>
        public void visitNode(AccessibilityHelper ah)
        {
            // does this ah need to be clicked or something to get to its children?
            if (1 == m_logLevel)
                m_log.paragraph(makeNameTag() + "Click found &quot;" + ah.Role + ":" + ah.Name + "&quot;");

            if ((ah.Role == AccessibleRole.MenuItem) || (m_for != null && "all" == (string)m_for))
            {
                if (1 == m_logLevel) m_log.paragraph(makeNameTag() + "Click determining what to do with this intermediate step");
                bool isFocused = (ah.States & AccessibleStates.Focused) == AccessibleStates.Focused;
                if (!isFocused)
                {
                    if (1 == m_logLevel) m_log.paragraph(makeNameTag() + "Clicking relative to &quot;" + ah.Role + ":" + ah.Name + "&quot; by (" + m_dx + ", " + m_dy + ") since it does not have focus");
                    ah.SimulateClickRelative(m_dx, m_dy);
                }
                else
                {
                    if (1 == m_logLevel) m_log.paragraph(makeNameTag() + "Click hovering on &quot;" + ah.Role + ":" + ah.Name + "&quot; since it has focus");
                    ah.MoveMouseOverMe(); // hover
                }
            }
        }