Telerik Forums
Testing Framework Forum
23 answers
1.0K+ views
hi,

My application has a table, i have to search for an item in a table. How to do that?

Thanks
Sudarshan
Boyan Boev
Telerik team
 answered on 22 Oct 2015
5 answers
185 views

Hi, hospital form guy here, searched and didn't find anything

Just wondering, is there any way to stop a test if any errors appear in the console? Like is there a way to check? And I mean any errors, not just JavaScript ones or anything like that. And I'm not talking about logging the errors, just stopping the test and showing the console errors.

 

Thanks in advance.

veri555999
Top achievements
Rank 1
 answered on 20 Oct 2015
5 answers
245 views

Hi ,

I am running few test scripts .Error i am getting is "element not found" for hyperlinkbutton,DataGrid,Listbox.I tried to find it by name as well as by type,but nothing works for me.I used silverlight spy to get the properties of the element.Attached is the details I got using silverlight spy.

Below is the details of error

<ErrorInfo>
              <Message>Test method FF_TEST.FINDING threw exception: 
ArtOfTest.Common.Exceptions.FindElementException: Element Not found!
FindExpression used: 
[name 'Exact' dgProduct ]
</Message>
              <StackTrace>    at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo, Object target)
   at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout, WaitResultType errorResultType)
   at ArtOfTest.WebAii.Silverlight.VisualWait.ForExistsInternal(Int32 timeout, Boolean invertCondition)
   at ArtOfTest.WebAii.Silverlight.VisualWait.ForVisible(Int32 timeout)
   at ArtOfTest.WebAii.Silverlight.VisualFind.ReturnOrThrow(FrameworkElement e, String throwMessage)
   at ArtOfTest.WebAii.Silverlight.VisualFind.ByName(String name)
   at ArtOfTest.WebAii.Silverlight.VisualFind.ByName[T](String name)
   
</StackTrace>
            </ErrorInfo>

my code is

var productGrid = app.Find.ByName<ArtOfTest.WebAii.Silverlight.UI.DataGrid>("dgProduct");

I tried below line as well

var productGrid = app.Find.ByName("dgProduct").As <DataGrid> () ;

it was noticed that productGrid variable is getting assigned with null value.

Similar issue is found with other controls like hyperlinkbutton ,listbox and label 

Please guide me to solve this issue

Ivaylo
Telerik team
 answered on 16 Oct 2015
4 answers
114 views

Hi, hospital form guy here

Situation: every hospital form has the same header which uses the same piece of code for testing. I currently have 2 form tests written. Problem is, the same code is copy-pasted in both tests. If I want to make changes to the header code, I have to change it in every test, which is not very convenient.


Situation that would be useful:

1. Launch test

2. Test includes the header code and tests it.

3. Test continues running its test-specific code.

 

How could I achieve this? Thank you in advance.

veri555999
Top achievements
Rank 1
 answered on 15 Oct 2015
6 answers
219 views
Hi,

I try to use Find.jQuery() to click on a picture in a dynamically javascript generated tree, but i don't understand how it works. :(

As you can see in attachments (F12 in Chrome), the highlighted line is the element that I try to click.

In first i've just tried to use Find.ByExpression but it always returns null in liItem  (The parent LisItem have a unique guid as id)
HtmlListItem liItem = Find.ByExpression<HtmlListItem>("id=56e5c928-4413-4a36-8676-72bea0c4e51d");
liItem.Find.ByExpression<HtmlImage>("class=menu-button").MouseClick();
I think it's due to the fact that the code is not html hardcoded but generated by JS.

How can I use Find.jQuery() (or another function) to make a MouseClick on this picture ?

Thanks :)
Boyan Boev
Telerik team
 answered on 15 Oct 2015
2 answers
99 views

I'm trying to find a parent Div by the <h2> TextContent = "Cleaning and Inspection (LLT)" by iterating throw aReadOnlyCollection of HtmlDivs and get a NullException.

public ReadOnlyCollection<HtmlDiv> InfoObjectList
        {
            get
            {
                return GetDataTab().Find.AllByExpression<HtmlDiv>("class=infoObjPrint");
            }
        }
 
        public virtual HtmlDiv GetInfoObject(string infoObjectText)
        {
            foreach (var item in InfoObjectList)
            {
                var text = item.Find.ByContent("h2").TextContent.Trim();
                if (text.Equals(infoObjectText))
                {
                    return item;
                }
            }
            return null;
        }

<div class="infoObjPrint" id="S05842977912008092400000">
  <a data-name="S05842977912008092400000"></a>
  <h2><span class="searchTermHighlight">Cylinder Head</span> Cleaning and Inspection (LLT)</h2>
  <div class="tipsContainer" data-id="S05842977912008092400000"></div>
  <p>
    <span class="clsListTitle">Tools Required</span>
  </p>
  <ul class="clsBULLET">
    <li>
      <span class="clsEmphBOLD">EN 46122 </span>

Boyan Boev
Telerik team
 answered on 12 Oct 2015
2 answers
149 views

Hi I am evaluating telerik Testing Framework to Automate my test. The page "http://docs.telerik.com/teststudio/testing-framework/write-tests-in-code/silverlight-wpf-automation-wtc/locating-elements" shows that one can use "Automation Id", "ByText" etc except ByName (Which doesn't work, it doesn't find the textbox). 

Also i used "app.FindName<TextBox>("Password").Text = "xyz";"  But this throws an error saying it cannot find the element.

Please let me know what I am missing.

Ivaylo
Telerik team
 answered on 07 Oct 2015
1 answer
283 views

I am trying to get the AutomationProperties.ItemStatus using the Telerik Test framework and it does not seem to exist anywhere. Is the only way around it to do the following? Surely there is a way directly from Telerik framework?

Get the handle from the Telerik framework and then use the System.Windows.Automation framework as follows...

var wpfHandle = customTelerikFrameworkElement.wpfWindow.Window.Handle

System.Windows.Automation.AutomationElement.FromHandle(this.wpfWindow.Window.Handle);                 

var root = System.Windows.AutomationAutomationElement.RootElement;                 

var image = root.FindFirst(TreeScope.Descendants, new System.Windows.Automation.PropertyCondition(System.Windows.Automation.AutomationElement.AutomationIdProperty, indicatorImage.AutomationId));

var props = image.GetSupportedProperties();                 

var prop = props.FirstOrDefault(p => p.ProgrammaticName == "AutomationElementIdentifiers.ItemStatusProperty");

var statusPropertyValue = image.GetCurrentPropertyValue(prop);

Ivaylo
Telerik team
 answered on 05 Oct 2015
2 answers
133 views

I believe there is a bug with the InputValue property. I have two kendo numeric text boxes, each with different values. However, when attempting to get the values they always return the value of the first box. I know the right ones are being selected because I can add attributes and get the correct attributes back. Just the InputValues return incocrrectly

var elements = myManager.ActiveBrowser.Find.AllByXPath("//div[@id='glazeWindow']//*[contains(@class,'k-widget')]");
KendoInput txtOne = elements[0].As<KendoInput>();
var q = txtOne.Attributes;
KendoInput txtTwo = elements[3].As<KendoInput>();
var z = txtTwo.Attributes;
Debug.WriteLine(txtOne.InputValue);<br>Debug.WriteLine(txtTwo.InputValue);

<tbody class="ng-scope" ng-repeat="item in editBuildingFloorArea.placeSizes"><br><br><tr><br><br><td><br><br><span class="k-widget k-numerictextbox" style=""><br><br><span class="k-numeric-wrap k-state-default k-expand-padding"><br></span><br></td><br><br><td><br><br><td><br><br><td class="center"><br></tr><br></tbody><br><br><tbody class="ng-scope" ng-repeat="item in editBuildingFloorArea.placeSizes"><br><br><tr><br><br><td><br><br><span class="k-widget k-numerictextbox" style=""><br><br><span class="k-numeric-wrap k-state-default k-expand-padding"><br></span><br></td><br><br><td><br><br><td>

 

Boyan Boev
Telerik team
 answered on 02 Oct 2015
7 answers
133 views

Hi All,

 I have seen about 5 or 6 threads on this issue with no real solution or explanation given. I am in Visual Studio 2013 with Telerik Testing Framework. I am using examples provided by your support staff. I have added ArtOfTest.WebAii and Telerik.TestingFramework.Controls.KendoUI references to my solution. Then I have added the following namespaces to my test file (most of which I know are not necessary):

using ArtOfTest.WebAii;
using ArtOfTest.WebAii.Controls;
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.ObjectModel;
using NUnit.Framework;
using Telerik.TestingFramework.Controls.KendoUI;

 

namespace VNextTelerik
{
    [TestFixture]
    public class Class1
    {
        public Manager myManager;
 
        [SetUp]
        public void TestFixtureSetUp()
        {
 
            // Initialize the settings
            Settings mySettings = new Settings();
 
            // Set the default browser
            mySettings.Web.DefaultBrowser = BrowserType.FireFox;
 
            // Create the manager object
            myManager = new Manager(mySettings);
 
            // Start the manager
            myManager.Start();
 
            
 
        }
         
        [Test]
        public void Kendo()
        {
 
            myManager.LaunchNewBrowser();
 
            myManager.ActiveBrowser.NavigateTo("http://demos.kendoui.com/web/numerictextbox/events.html");
 
            System.Threading.Thread.Sleep(5000);
 
            myManager.ActiveBrowser.RefreshDomTree();
 
            KendoInput textBox = myManager.ActiveBrowser.Find.ByExpression<KendoInput>("class=k-widget k-numerictextbox");
 
            textBox.TypeText("50");
        }
 
        [TearDown]
        public void TearDown()
        {
            // Shut-down the manager and do all clean-up
            myManager.Dispose();
        }
 
    }

Every time it runs (KendoInput textBox = myManager.ActiveBrowser.Find.ByExpression<KendoInput>("class=k-widget k-numerictextbox");) this  returns null. I have tried many many things changing DomRefreshTree, waiting for element, longer thread.sleep (terrible solution). Ive tried to intialize the object as so(KendoInput textBox = new  KendoInput).What could be the issue?  Ive ran it at least 40 times and only one time did it actually find the object.  Ive attached the solution. In all the other threads with this problem your support staff runs peoples project and says it works. I am looking for a reason this may be happening and a possible solution.

 

thanks

Ivaylo
Telerik team
 answered on 02 Oct 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?