locked
locate a OK button in javascript popup message box RRS feed

  • Question

  • I want to locate a javascript popup message box's ok button.

    WinWindow ww = new WinWindow(this.UIOnlyHRSystemWindowsIWindow.UIOnlyHRSystemDocument);
                ww.WindowTitles.Add("来自网页的消息");
                WinButton wb = new WinButton(ww);
                wb.SearchProperties[WinButton.PropertyNames.DisplayText] = "确定";
                Mouse.Click(wb);
    my code like above, but it cannot work, please give me some guide, thank you

    Tuesday, December 4, 2012 2:28 AM

Answers

  • Hello Wayne,

    Thank you for posting in the MSDN forum.

    According to your exception information, I suggest that you can search the control with greater unique and valid properties such as ControlName, Control Class and ID.

    You can drag the crosshair to the button and then its properties will display. You can use those properties to target a control during playback.

    Here are useful blogs with some searchproperties samples that may help you:

    Hand-coding a Coded UI Test

    How does “Coded UI test” finds a control ??

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 4, 2012 7:36 AM
    Moderator
  • Hello Wayne,

    Have you resolved this issue? Could you get useful information from our reply?

    If you have resolved it, please mark the helpful reply as answer.

    If not, please let us know the latest news about this issue and the result of our suggestion.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Wayne.Wu Thursday, December 6, 2012 12:49 PM
    Thursday, December 6, 2012 12:29 AM
    Moderator
  • I found easiest method is by invoking WinWindow.PerformDialogAction method, after calling this method, the CodedUI will move mouse automatically and click popup JS OK button.


    or there was another way, is by record whole process in coded ui and analysis the generated coded, it is very tedious way to handle this situation.

    • Marked as answer by Wayne.Wu Thursday, December 6, 2012 12:52 PM
    Thursday, December 6, 2012 12:52 PM

All replies

  • Hello Wayne,

    Thank you for posting in the MSDN forum.

    According to your exception information, I suggest that you can search the control with greater unique and valid properties such as ControlName, Control Class and ID.

    You can drag the crosshair to the button and then its properties will display. You can use those properties to target a control during playback.

    Here are useful blogs with some searchproperties samples that may help you:

    Hand-coding a Coded UI Test

    How does “Coded UI test” finds a control ??

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 4, 2012 7:36 AM
    Moderator
  • Hello Wayne,

    Have you resolved this issue? Could you get useful information from our reply?

    If you have resolved it, please mark the helpful reply as answer.

    If not, please let us know the latest news about this issue and the result of our suggestion.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Wayne.Wu Thursday, December 6, 2012 12:49 PM
    Thursday, December 6, 2012 12:29 AM
    Moderator
  • I found easiest method is by invoking WinWindow.PerformDialogAction method, after calling this method, the CodedUI will move mouse automatically and click popup JS OK button.


    or there was another way, is by record whole process in coded ui and analysis the generated coded, it is very tedious way to handle this situation.

    • Marked as answer by Wayne.Wu Thursday, December 6, 2012 12:52 PM
    Thursday, December 6, 2012 12:52 PM
  • sorry, it is BrowserWindow.PerformDialogAction(BrowserDialogAction.Ok);
    Friday, December 7, 2012 2:21 AM