locked
Coded UI can see the texbox in one instance, but not the other RRS feed

  • Question

  • I have a very disturbing problem that I believe has been prompted by the application that I'm testing, but I'm posting about to see if anyone has run into this before and found a solution.

    I have to navigate thru three mouse click to get to a textbox (textbox1) in which I'm trying to enter text.

    If I click the three buttons manually, I can then use coded UI to enter text into textbox1.

    If I use coded UI to click all the buttons and enter text into texbox1 it fails to find textbox1.

    This happens even if I manually code the navigation or even when I use recording.

    The page where the third button exists is in Panel 2.  The Textbox1 is in Panel 3. There is a total of three panels in the page.

    I have tried to get all textboxes from all panels and then access the textbox from the collection, but that fails too when I navigate using coded UI to click the buttons etc.

    Anyone???   Understand that I'm working with a poorly designed application when it comes to accessibility.


    NR


    Monday, May 8, 2017 2:05 AM

Answers

  • So I have been coding manually and not using the recording mechanism unless necessary.  You are correct in that regard.

    The 3rd button works now after I rediscovered it.  I had done that before to no avail, but now it works.

    The textbox1, I believe the problem is that it is encapsulated in a DevExpress Edit control that is not properly defined. It only has a control type of Edit and a help text that is not visible.  CodedUI can not find it when I use the "Locate UI Control" feature.

    I'm moving on and using Keyboard send keys and tabbing to locations as necessary.  It is a brittle strategy, but it has to do for now.


    NR

    • Proposed as answer by Fletch Zhou Tuesday, May 9, 2017 4:12 PM
    • Marked as answer by Highlander4 Wednesday, May 10, 2017 6:47 PM
    Tuesday, May 9, 2017 2:55 PM

All replies

  • Hi friend,

    Thanks for you posting.

    >>If I use coded UI to click all the buttons and enter text into texbox1 it fails to find textbox1.

    How's your test code like?  It failed to find the textbox1, what's the exception message?

    >> If I click the three buttons manually, I can then use coded UI to enter text into textbox1.

    Could you use cross-hair to capture the three buttons? What if you use MouseClick() method on the three buttons(using the control name captured by cross-hair)?

    Please feel free to share us the test code and error message.

    Best regards,

    Fletch

     


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, May 8, 2017 1:19 PM
  • 1- The exception message is that it couldn't find the control.

    2- The cross-hair can be used if I open the Pane where texbox1 is found for the first time and leave it undisturbed. Most of the time the cross-hair cannot see it.  In the latter when the cross-hair is placed on textbox1 on the second pane, I get the first pane frame outline highlighted.  I can use the cross-hair to capture the buttons, but for the third button I have to record its click, because accessing it programatically doesn't work.

    3- The controls are inside a control type = Custom with a name = Uia.BasicSettingsView

    The only way I can write to textbox1 is to tab to it and send keyboard keys.  Unfortunately, there are too many other controls in the same area, reason why I'm trying to find a solution to capture the objects.

    I can share the code, however but, it seems to be basic usage and have tried different ways of capture.  I have captured the controls either manually or via recording. If I record the whole thing, including writing to the textbox, when it gets to that point it fails to find it as well.



    NR


    Monday, May 8, 2017 3:01 PM
  • Hi friend,

    >> I can use the cross-hair to capture the buttons, but for the third button I have to record its click, because accessing it programatically doesn't work.

    How come? Does it mean the third button is not recognized by cross-hair?

    Is it possible because we need operate the series of actions step by step, I mean like hierarchy, eg. click the first, Playback.Wait(3000)(wait for a few seconds), then click the next one, at last comes to the textbox.

    I still think we could make the coded UI test run, if you could do the action manually and the controls are both supported by coded UI test builder, at least we could hand coded it to generate the test. 

    I totally understand that generate the test by recording is that robust as hand coded, it would fail due to many reason as it records controls according to their coordinate other than search properties.

    If we use cross-hair to capture the controls, add them to UIMap, and write the test code jus like we treat the controls manually, I think most time we'll make it, at least I do.

    Best regards,

    Fletch   


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Tuesday, May 9, 2017 10:25 AM
  • So I have been coding manually and not using the recording mechanism unless necessary.  You are correct in that regard.

    The 3rd button works now after I rediscovered it.  I had done that before to no avail, but now it works.

    The textbox1, I believe the problem is that it is encapsulated in a DevExpress Edit control that is not properly defined. It only has a control type of Edit and a help text that is not visible.  CodedUI can not find it when I use the "Locate UI Control" feature.

    I'm moving on and using Keyboard send keys and tabbing to locations as necessary.  It is a brittle strategy, but it has to do for now.


    NR

    • Proposed as answer by Fletch Zhou Tuesday, May 9, 2017 4:12 PM
    • Marked as answer by Highlander4 Wednesday, May 10, 2017 6:47 PM
    Tuesday, May 9, 2017 2:55 PM
  • Hi friend,

    Thanks for your response.

    Keyboard.Sendkeys() method is useful, sometimes I also use ENTER key instead of Mouse.Click()  under some certain situations where Mouse.Click() does not work with no reason.

    If you issue is resolved now, you could help to mark a reply as answer if it's okay for you. Please feel free to let us know if you need more help.

    Best regards,

    Fletch


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Fletch Zhou Wednesday, May 10, 2017 2:16 AM
    Wednesday, May 10, 2017 2:16 AM