1

I'm using CUITe to automate the testing of a UI piece (captured as a Page Object model).

I have a class that captures the buttons in my UI, like so:

class Navigators : CUITe_BrowserWindow
{
  public new string sWindowTitle = "Window";
  public CUITe_HtmlInputButton next = new CUITe_HtmlInputButton("Id=Content_btnNext");

  // Other such buttons

  //And a method to click any button
  public void ClickButton(string id)
  {
    CUITe_BrowserWindow.GetBrowserWindow<Navigators>().Get<CUITe_HtmlInputButton>(string.Concat("Id=", id)).Click();
  }
}

And the test I'm trying to automate is this, the click of a button:

CUITe_BrowserWindow.Launch<Navigators>("url");
CUITe_BrowserWindow.GetBrowserWindow<Navigators>().ClickButton("Content_btnNext");

My problem is this: When I project my screen to a secondary monitor and extend it, the 'Next' button is clicked perfectly. However, on my system, the mouse passes over the button to another position and the click doesn't happen.

I have tried refreshing the CodedUI cache (by setting SearchConfiguration to Always), but that hasn't worked. Also, SetFocus on the control works correctly, whereas DrawHighlight shows the wrong position.

Any help would be greatly appreciated.

EDIT When I changed my screen's resolution to 1440x900 (which is that of the secondary monitor's), the click happened.

I would be glad if someone could provide links that show how to handle screens of different resolutions in Coded UI

notauser
  • 33
  • 5
  • Did you add the SearchConfiguration Always to every control in the button's hierarchy? – jeff Mar 20 '14 at 18:01
  • Hi Jeff, as I understand it, CUITe does not use a control hierarchy; instead, controls are bound to the top - level container, which would be the browser window in my case. – notauser Mar 21 '14 at 03:46

2 Answers2

0

This is how I click controls on Win 8.1 store app which may or maynot be of help to you:

            Mouse.Click(new Microsoft.VisualStudio.TestTools.UITest.Input.Point(uiControl.Left + (uiControl.Width / 2), uiControl.Top + (uiControl.Height / 2)));
mr.X
  • 291
  • 1
  • 6
0

Below is how I've been doing it in my CUITe scripts & it works fine at 1920x1080 on my larger monitor & at 1280x1024 on my laptop screen.

Given your OR definition above.

using Navigators.ObjectRepository; //guessing the name here

var pgNavigator = new Navigators();

//whatever else you do before clicking on next

Navigators.next.Click();
Ravana
  • 11
  • 2