Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location returns wrong coordinates when apps screen slides up due to some input getting focus #34

Closed
NickAb opened this issue May 23, 2015 · 1 comment
Labels

Comments

@NickAb
Copy link
Contributor

NickAb commented May 23, 2015

Coordinates returned by location command and used by click command are incorrect when apps screen slid up due to some input being focused, e.g. AutoSuggestBox, which leads to driver tapping incorrect screen point.

See AutoSuggestSample.cs. Replacing temporary execute script solution with suggest.Click() in test case will result in incorrect tap.

Possible solution: use GetClickablePoint for all elements that support it instead of current screen point calculation algorithm.

Simple replacement of location algorithm with GetClickablePoint resulted in test_automation_scroll failing, needs further investigation.

@NickAb
Copy link
Contributor Author

NickAb commented Jun 15, 2015

Turns out that Frame passed to AutomationServer.Instance.InitializeAndStart not actual a root elements as whole application is wrapped into ScrollViewer that allows system to scroll application top to make place for on-screen keyborad, etc. This was causing the incorrect location being returned in case of on-screen keyboard or other system windows scrolling application view to top.

This can be fixed by something like

public Automator(UIElement visualRoot)
        {
            var root = visualRoot;

            while (true)
            {
                var parent = VisualTreeHelper.GetParent(root) as UIElement;
                if (parent == null)
                {
                    break;
                }

                root = parent;
            }

            this.VisualRoot = root;
            this.WebElements = new AutomatorElements();
        }

This will get rid of need to use GetClickablePoint and Actions to click to suggests.
Still needs research on possibility of replcaing custom location getter with GetClickablePoint.

NickAb pushed a commit that referenced this issue Jun 19, 2015
Fixes #34 incorrect element location being returned if app is scrolled up to make place for on-screen keyboard, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant