Simulating ENTER on locked screen

11 posts, 0 answers
  1. Martin
    Martin avatar
    51 posts
    Member since:
    Dec 2011

    Posted 18 Jan 2012 Link to this post

    Hi

    How do i simulate what happens when a user press ENTER?

    Scenario:
    User fills in login information and while password field has focus hits enter to login.

    I need to automate that scenario, but i can't use Desktop.KeyBoard because it has to work on a locked screen.

    How can i do that using Telerik?


    I know selenium can do something like .Sendkeys("\n"); for a ENTER key. (which works on locked screens)
  2. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 18 Jan 2012 Link to this post

    Hi Martin,
    I don't believe a true, desktop keyboard click can be simulated on a locked desktop with any UI automation tool.

    What should work is a DOM click (which is different from a desktop click that simulates a physical user).
     
    You can implement a DOM click by finding the "Submit" button in code:
    HtmlInputButton button = Find.ByContent<HtmlInputButton>("Submit");
    button.Click(false);

    Greetings,
    Stoich
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Martin
    Martin avatar
    51 posts
    Member since:
    Dec 2011

    Posted 19 Jan 2012 Link to this post

    Hi Stoich

    I know i can click the submit button, but what i was looking for is a way to automatically test that if a user does the following:

    Type: Login
    Type: Pass
    Hits: ENTER

    That the user is then logged in, am i to understand that Telerik cannot test this?



    If it's the case that Telerik have no way of simulating anything similar to a ENTER hit without running on a open screen then i have another problem.

    How do i handle a search field with no click button? A text field that conducts search when ENTER is pressed but with no UI button to click??


    Again remember it's a requirement that this can be done on locked screens.
  4. Martin
    Martin avatar
    51 posts
    Member since:
    Dec 2011

    Posted 19 Jan 2012 Link to this post

    Hi

    Did some more digging.

    _driver.FindElement(By.XPath("//input[contains(@id, 'TopLoginControl_loginEmail')]")).SendKeys("LOGIN");
    _driver.FindElement(By.XPath("//input[contains(@id, 'TopLoginControl_loginPassword')]")).SendKeys("PASS");
    _driver.FindElement(By.XPath("//input[contains(@id, 'TopLoginControl_loginPassword')]")).SendKeys("\n");


    This code will do the trick in selenium, it may not be the perfect simulation but it's good enough to find a bug which is about some login forms doesn't submit on ENTER and others do.

    And that code will run with or without locked screen just the same


    I hope you can help find a way Telerik can solve the problem so I don't have to do manual regression test of this.
  5. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 19 Jan 2012 Link to this post

    Hello Martin,

    I would like to step in for a moment and just clarify a couple of points.

    1) Yes Test Studio can simulate pressing the Enter key. Our recorder will record it automatically and add it as a non-coded test step. This can also be done in code this way:

    Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Enter);

    2) No Test Studio (and most UI automation tools) are not able to do anything with the keyboard or mouse input events on a locked machine. This is a Windows security limitation. When the machine is in the locked state Windows removes the "Interactive desktop" permission.

    A common way to work around this is to a VNC type of product. These products act like a video card such that when you disconnect the VNC connection without logging off, Windows doesn't actually enter the "locked" state leaving UI automation tools free to run unhindered on a headless machine.

    I hope that clarifies the situation we're dealing with here.

    Greetings,
    Cody
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Martin
    Martin avatar
    51 posts
    Member since:
    Dec 2011

    Posted 20 Jan 2012 Link to this post

    It clarifies as much as Telerik having a limitation that Selenium doesn't.

    But it doesn't really help me much :(.


    Do Telerik have any plan of implementing a feature similar to what Selenium does? lets just call it FakeEnter()?
  7. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 20 Jan 2012 Link to this post

    Hi,

    I understand the dilemma. Is there a reason/problem preventing you from trying a VNC product?

    Yes, eventually we will be implementing the ability for tests to run unhindered on a locked machine. We have already done some initial investigation on what it would take and have determined it is not a trivial change to make it work reliably across all versions of Windows.

    All the best,
    Cody
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Martin
    Martin avatar
    51 posts
    Member since:
    Dec 2011

    Posted 20 Jan 2012 Link to this post

    Hi,

    Thanks for the response.

    Regarding VNC I haven't looked into it yet, do you have a link to where I can read about it you would recommend?

    Regards
    Martin
  9. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 20 Jan 2012 Link to this post

    Hi,

    Yes, here's the link I included on my Jan 19th response to you.
    http://en.wikipedia.org/wiki/VNC 

    Regards,
    Cody
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  10. Russ
    Russ avatar
    6 posts
    Member since:
    Apr 2014

    Posted 20 Jan Link to this post

    Hi Cody, we are having this issue now with running automated tests.  We are not allowed to use VNC.  Has Telerik made any progress in allowing us to run our tests headless?
  11. Boyan Boev
    Admin
    Boyan Boev avatar
    1039 posts

    Posted 22 Jan Link to this post

    Hello Russ,

    Any test that requires moving the mouse or sending key strokes still requires an unlocked desktop.

    Telerik tests are not the only types affected by this Windows limitation. You will find this is a general problem with any tool that performs UI testing.

    Thank you for your understandings.

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top