Telerik Forums
Testing Framework Forum
3 answers
183 views

I have next code to handle OpenFileDialog in WPF app tests:

var dialog = OpenFileDialog.CreateOpenFileDialog(Manager.ActiveApplication, DialogButton.OPEN, pathToImportFile, "Open");
Manager.DialogMonitor.AddDialog(dialog);
Manager.DialogMonitor.Start();
importStep1.Find.ByType("RadButton").User.Click();
dialog.WaitUntilHandled(10000);

 

But sometimes my test doesn't work correctly. The dialog box remains open (with correct title - "Open"), but I have next erroe:

Message: System.TimeoutException : Timed out waiting '10000' msec. for any dialog to be handled '1'

 

This happens in half of the cases when the same test is run, without any changes.

Elena
Telerik team
 answered on 18 Apr 2018
1 answer
123 views

Have 2 pc. All is local machines, no one rdp. Have a same test (WPF app). In the first pc tests pass done without any problem, but in the second I have a strange problem - no one of mouse actions isn't working (Move, Click, TurnMouseWheel). Any reasons why?

 

Simple part of tests code:

 

var importButton = Manager.ActiveApplication.MainWindow.Find.ByTextContent("Import");
importButton.Wait.ForVisible(5000);
 
TestContext.WriteLine("Hover.");
importButton.User.HoverOver();
 
TestContext.WriteLine("Click.");
importButton.User.Click();
Elena
Telerik team
 answered on 18 Apr 2018
1 answer
94 views

User.Click hangs application

 

hi ,

 

i have text block control in a ListViewItem which i am fetching using code below after attaching to an already running application

 

 Manager manager = new Manager(settings);
            manager.Start();
            Process[] s = Process.GetProcesses();
            var sss = s.Where(x => x.MainWindowTitle.Contains("Winshuttle Studio")).FirstOrDefault();
           var apdp =  manager.ConnectToApplication(sss);
            
            var app = manager.ActiveApplication;
            wpfApplication = app;

 

 

 POM1 pOM1 = new POM1(wpfApplication.MainWindow.Find);
              //  var aa = pOM1.FileNameTextBlockTextblock.Text;
                Application.wpfApplication.MainWindow.PopulateVisualTree();
                // var asss = pOM1.DescrTextblock0;
                var hh = pOM1.ListViewRow;

 

 /// Find logic /Property of row item in POM1
        /// (Wpf): [name 'Exact' rrvRibbon] AND [XamlTag 'Exact' radribbonview][XamlPath 'Exact' /grid[name=RootPanel]/rectangle[0]]
        ///
        /// </summary>
        public ArtOfTest.WebAii.Controls.Xaml.Wpf.ListViewItem ListViewRow
        {
            get
            {
                return Get<ArtOfTest.WebAii.Controls.Xaml.Wpf.ListViewItem>("XamlTag=listviewitem", "automationid=SapField~BDC_CURSOR##8");
            }
        }

 

 

                ArtOfTest.WebAii.Controls.Xaml.Wpf.Grid descriptionBlock = hh.Find.ByName< ArtOfTest.WebAii.Controls.Xaml.Wpf.Grid>("descriptionGrid");
                var ffff = descriptionBlock.Find.ByType<ArtOfTest.WebAii.Controls.Xaml.Wpf.TextBlock>();

                ffff.User.Click();

the issue is after this or any other call like settext to any element , the click operation is performed the execution goes to next step , but the application freezes and stop responding , after i halt the exe/execution application comes to normal state

setting used: 

 

var settings = new Settings();
                settings.Wpf = new ArtOfTest.WebAii.Core.Settings.WpfSettings(@"C:\Program Files (x86)\Winshuttle\Studio\Winshuttle Studio.exe");
                settings.ClientReadyTimeout = 60000;
                settings.ElementWaitTimeout = 60000;
                settings.ExecuteCommandTimeout = 60000;
                settings.ExecutionDelay = 60000;
                settings.WaitCheckInterval = 9000;
                settings.RunnerResponseTimeout = 9000;
                settings.SimulatedMouseMoveSpeed = 0.5f;
                settings.AnnotateExecution = true;
                settings.AnnotationMode = AnnotationMode.All;
environment : win10 , wpf application

 

Elena
Telerik team
 answered on 18 Apr 2018
1 answer
1.8K+ views

Hi,

 

I'm reviewing the Telerik Testing Framework with WPF. I've managed to launch our application, find 'elements' by Automation ID and I'm able to click these. However, we open a text input window when clicking a button. The text input window is a 'child' window for the MainWindow, however, I'm unable to find any of the visible AutomationID's. Do I need to change to the 'child' window? If so how do I do this?

 

Thanks.

Elena
Telerik team
 answered on 17 Apr 2018
7 answers
183 views

Hello,

Maybe this is a newbie question but I am not able to achieve what I want.

I have created a custom Dialog inheriting from GenericDialog.
I have overridden the Handle method and I am doing what I want to achieve with it but ( there is always a but) I am not able to mark or tell the consumer code that the handle has finished.

Here is my code:

My custom Class:
 public class GenericDialog
    {

     ....

public override void Handle()
        {
            if (this.HandlerDelegate != null)
            {
                this.HandlerDelegate(this);
            }
            else
            {
                try
                {
                    System.Threading.Thread.Sleep(100);

                    InvokePrint.Invoke();

                    System.Threading.Thread.Sleep(100);

                    Window currentWindow = WindowManager.FindWindowRecursively(IntPtr.Zero, "Save Print Output As", false, 1500);
                    if (currentWindow != null)
                    {
                        currentWindow.SetFocus();
                        currentWindow.SetActive();

                        ArtOfTest.WebAii.Win32.Button saveButton = new ArtOfTest.WebAii.Win32.Button(currentWindow.Handle, ButtonAutomationId);

                        (Window child in currentWindow.AllChildren)
                        {
                            if (child.ContainsControl(FileNameAutomationId))//FileNameText
                            {
                                child.SetFocus();
                                child.SetActive();
                                SetFileName.Invoke();

                                System.Threading.Thread.Sleep(500);
                            }
                        }

                        if (saveButton != null)
                        {
                            System.Threading.Thread.Sleep(500);

                            //ActionToPerform.Invoke();
                            saveButton.SetFocus();
                            saveButton.SetActive();
                            saveButton.Click();
                            InvokePrint.Invoke();
                        }

                        System.Threading.Thread.Sleep(5000);

                        InvokePrint.Invoke();
                    }

                    this.HandleCount = 0;

                    this.Window.Close();

                    // Make sure the dialog is knocked down.
                    this.Window.WaitForVisibility(false, 500);
                }
                catch (Exception ex)
                {
                    // Do any custom handling and return error.
                    throw;
                }
            }

}
The Consumer Method which is in another class:
private void PrintTax()
        {
            try
            {
                PrintDialog printDialog = new PrintDialog(ActiveBrowser, PrintDialogText, false, PrintDialogText);  // Click on the Print button

                printDialog.InvokePrint = InvokePrint;
                printDialog.SetFileName = EnviarPath;
                

                Manager.DialogMonitor.AddDialog(printDialog);

                Manager.DialogMonitor.Start();

                //Click the link that launches the security dialog
                ImprimirTasaButton();

                printDialog.WaitUntilHandled(20000);

                Manager.DialogMonitor.Stop();
            }
            catch (Exception ex)
            {

                //TODO: Log this exception
                throw;
            }

        }

Note: This code is still a Work in progress but I am getting a timeout exception as it seems it has been never handled even though I have done all I wanted to do.

I hope you could help me with this.
Elena
Telerik team
 answered on 16 Apr 2018
3 answers
120 views

Hello,

I haven't found the same situation on the forum.

My scenario is the following one:

In a certain step of my web Automation Test, I need to capture what I am seeing on the web page. That's why I am using the GetBitmap() method.
Most of the times it works but sometimes, I don't know the reason, I get a blank content instead of what I am actually seeing. (Image attached)

Here is my code (is still a work in progress as I haven't made this work perfectly)

           System.Drawing.Bitmap browserImage = null;
            try
            {
                Manager.ActiveBrowser.RefreshDomTree();
                Manager.ActiveBrowser.WaitUntilReady();

                ActiveBrowser.Window.Show();
                Manager.ActiveBrowser.Window.WaitForVisibility(true, 5000);
                ActiveBrowser.Window.SetActive();
                ActiveBrowser.Window.SetFocus();

                //Operar sobre la Tabla para ver si con esto se fuerza que tenga el foco aquí
                Pages.Atenea0.Table.Focus();
                Pages.Atenea0.Table.Click();

                ActiveBrowser.ContentWindow.Show();
                ActiveBrowser.ContentWindow.SetActive();
                ActiveBrowser.ContentWindow.SetFocus();


                browserImage = ActiveBrowser.ContentWindow.GetBitmap();

                if (browserImage == null)
                {
                    ActiveBrowser.Window.RefreshChildren();
                    ActiveBrowser.ContentWindow.Show();
                    ActiveBrowser.ContentWindow.SetActive();
                    ActiveBrowser.ContentWindow.SetFocus();
                    browserImage = ActiveBrowser.ContentWindow.GetBitmap();
                }
                if (browserImage == null)
                {

                   browserImage = ActiveBrowser.Capture();
                }

I am a little bit lost as I said most of the times works but it's not acceptable for my goal to have something that randomly fails.
I hope you can help me with this.

Regards,
Sebastian

Ivaylo
Telerik team
 answered on 13 Apr 2018
3 answers
242 views

I have a scenario wherein I need to provide Authorization credentials before navigating to a webpage.
After going through the documentation provided here https://docs.telerik.com/teststudio/testing-framework/write-tests-in-code/advanced-topics-wtc/using-the-http-proxy I thought of using HttpProxy to intercept the request and inject "Authorization" header in the Request pipeline.
For some reason I am not able to see the HTTP headers that I am trying to inject. Am I doing something wrong here?

My function looks like this
public void NavigateWithCredentils(Uri navigateUrl)
{
RequestListenerInfo li = new RequestListenerInfo(AddCredentials);
Telerik.Manager.Http.AddBeforeRequestListener(li);
Telerik.ActiveBrowser.NavigateTo(navigateUrl);
Telerik.Manager.Http.RemoveBeforeRequestListener(li);
}

private void AddCredentials(object sender, HttpRequestEventArgs e)
{
if (e.Request.Headers.GetValues("Authorization") == null)
{
e.Request.Headers.Add("Authorization", "Basic realusername:realpassword");
}
}

Note: UseHttpProxy is already set to true in the Initialization code.

Ivaylo
Telerik team
 answered on 11 Apr 2018
3 answers
172 views

I have a css locator which using contains "input[id$='_btnManageEffectiveDates']" . But in testing framework I don't have any option to handle this kind of locator.

 

Elena
Telerik team
 answered on 09 Apr 2018
7 answers
661 views

Hello.

Your framework is very useful but what did you think about find elements by css selector(like WebDriver) or smth like that:

Find.ById("topPanel").Find.ByAttributes("class='buttonPanel'").Find.By.......

<div id="topPanel">
<div class="buttonPanel">
<a>Create New</a>
<a>Import</a>
<a>Create Deploy Configuration</a>
</div>
</div>

Elena
Telerik team
 answered on 06 Apr 2018
2 answers
104 views

Hi Telerik,

I have to capture memory footprint after garbage collection has been done. Is there any way we can know that garbage collection has been done?

I am seeing some memeory leaks when DOM increases. Can we force garbage collection using telerik testing framework?

Nikolay Petrov
Telerik team
 answered on 30 Mar 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?