Quantcast
Channel: Coded UI
Viewing all articles
Browse latest Browse all 2

Coded UI

$
0
0

Hello,

I created a function to click on the button in coded UI C#, it suddenly stopped working for buttons on a certain page as the same function was working before couple of hours, and I am using the same function from last one month for the same , I debugged the code and found out that the UITestControlCollection is coming zero and I have only used className , controlType and Display text to search the element, I am running the code on client side and is giving the error, nothing in the page has been change, Please find my code mentioned below.

public

staticvoidSubmit(stringDisplay_Text)

        {

           

try


            {

               

Playback.PlaybackSettings.AlwaysSearchControls = true;

               

BrowserWindowbr =newBrowserWindow();

               

if(BrowserWindow.CurrentBrowser.ToLower().Trim() == "ie")

                {

                    br.SearchProperties[

UITestControl.PropertyNames.ClassName] = "IEFrame";

                }

               

else


                {

                    br.SearchProperties[

UITestControl.PropertyNames.Name] = WinTitle;

                }

               

HtmlControlbtn =newHtmlControl(br);

                btn.SearchProperties[

HtmlControl.PropertyNames.ClassName] = "HTMLButton";

                btn.SearchProperties[

HtmlControl.PropertyNames.ControlType] = "Button";

                btn.SearchProperties[

HtmlButton.PropertyNames.DisplayText] = Display_Text;

               

UITestControlCollectionutcc = btn.FindMatchingControls();

                MouseClick(utcc);

               

try


                {

                   

Playback.Wait(5000);

                    WinTitle = br.Title.Replace(

" - Google Chrome","").Replace(" - Internet Explorer","").Replace(" - Mozilla Firefox","");

                }

               

catch


                { }

            }

           

catch(PlaybackFailureExceptione)

            {

               

Assert.Fail(e.Message);

            }

        }

Thanks

AL


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images