Telerik Forums
Testing Framework Forum
4 answers
140 views
Good morning,
I'm a newbie of this product. I try to mke same very simple test and they don't work :-(
My code is that:

using System;
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.TestTemplates;
using NUnit.Framework;
using Telerik.WebAii.Controls.Html;
using Assert = ArtOfTest.Common.UnitTesting.Assert;
 
namespace TelerikTestingFW
{
    /// <summary>
    /// Summary description for FirstStep
    /// </summary>
    [TestFixture]
    public class FirstStep : BaseTest
    {
 
        #region [Setup / TearDown]
 
        /// <summary>
        /// Initialization for each test.
        /// </summary>
        [SetUp]
        public void MyTestInitialize()
        {
            #region WebAii Initialization
 
            // Initializes WebAii manager to be used by the test case.
            // If a WebAii configuration section exists, settings will be
            // loaded from it. Otherwise, will create a default settings
            // object with system defaults.
            //
            // Note: We are passing in a delegate to the NUnit's TestContext.Out.
            // WriteLine() method. This way any logging
            // done from WebAii (i.e. Manager.Log.WriteLine()) is
            // automatically logged to same output as NUnit.
            //
            // If you do not care about unifying the log, then you can simply
            // initialize the test by calling Initialize() with no parameters;
            // that will cause the log location to be picked up from the config
            // file if it exists or will use the default system settings.
            // You can also use Initialize(LogLocation) to set a specific log
            // location for this test.
 
            // Pass in 'true' to recycle the browser between test methods
            Initialize(false, new TestContextWriteLine(Console.Out.WriteLine));
 
            // If you need to override any other settings coming from the
            // config section or you don't have a config section, you can
            // comment the 'Initialize' line above and instead use the
            // following:
 
            /*
 
            // This will get a new Settings object. If a configuration
            // section exists, then settings from that section will be
            // loaded
 
            Settings settings = GetSettings();
 
            // Override the settings you want. For example:
            settings.DefaultBrowser = BrowserType.FireFox;
 
            // Now call Initialize again with your updated settings object
            Initialize(settings, new TestContextWriteLine(Core.TestContext.Out.WriteLine));
 
            */
 
            #endregion
 
            //
            // Place any additional initialization here
            //
        }
 
        /// <summary>
        /// Clean up after each test.
        /// </summary>
        [TearDown]
        public void MyTestCleanUp()
        {
            //
            // Place any additional cleanup here
            //
 
            #region WebAii CleanUp
 
            // Shuts down WebAii manager and closes all browsers currently running
            this.CleanUp();
 
            #endregion
        }
 
        /// <summary>
        /// Called after all tests in this class are executed.
        /// </summary>
        [TestFixtureTearDown]
        public void FixtureCleanup()
        {
            // This will shut down all browsers if
            // recycleBrowser is turned on. Else
            // will do nothing.
            ShutDown();
        }
 
        #endregion
 
        [Test]
        public void SampleWebAiiTest()
        {
            // Launch a browser instance
            Manager.LaunchNewBrowser(BrowserType.Chrome);
 
            // Navigate the active browser to www.wikipedia.org
            ActiveBrowser.NavigateTo("http://www.wikipedia.org/");
 
            // Find the wikipedia search box and set it to "Telerik Test Studio";
            Find.ById<HtmlInputSearch>("searchInput").Text = "Telerik Test Studio";
 
            // Click the search arrow button
            Find.ByName<HtmlInputSubmit>("go").Click();
 
            // Validate that search contains 'Telerik Test Studio'
            Assert.IsTrue(ActiveBrowser.ContainsText("Telerik Test Studio"));
 
            //Read more here:
        }
        [Test]
        [Description("My simple demo")]
        public void SimpleTest()
        {
            // Launch an instance of the browser
            Manager.LaunchNewBrowser();
 
            // Navigate to google.com
            ActiveBrowser.NavigateTo("http://www.google.com");
 
            // verify the title is actually Google.
            Assert.AreEqual("Google", ActiveBrowser.Find.ByTagIndex("title", 0).InnerText);
        }
 
        [Test]
        public void ComboBoxText()
        {
            Manager.LaunchNewBrowser();
 
            RadComboBox combo = Find.ById<RadComboBox>("RadComboBox1");
 
            Assert.AreEqual("New York", combo.Text);
            Assert.AreEqual(true, combo.Text.Contains("New"));
            Assert.AreEqual(false, combo.Text.Contains("Test"));
        }
 
    }
}

The SampleWebAiiTest and SimpleTest goes without a problem but the ComboBoxTest doesn't. It never find the combo and so the combo object is null :-(
Why this things happen? I suppose a browser problem but with Explorer, Firefox and Chrome the problem still remain the same.
Any ideas?


Gianluca
Boyan Boev
Telerik team
 answered on 15 Jan 2013
1 answer
76 views
I have a silverlight5 grid control for which the DOM is as attached. it exposes only one object.
If i have to play around grid via automation i.e. clicking on any cell. what are the approaches
Plamen
Telerik team
 answered on 15 Jan 2013
1 answer
191 views
Hello Telerik,

During the debug of the application when I want to watch some properties of automation controls, Visual Studio is hanged for a while and then I get the message: Function evaluation timed out. It is really difficult to develop automated scripts, when debug capabilities doesn't work completely. Till this moment I have been debugging using Console.WriteLine statement.

I look forward to hearing from you.

Kind Regards,
Stanislav Hordiyenko
Plamen
Telerik team
 answered on 14 Jan 2013
1 answer
101 views
Hi All,

During my test i need to verify the following span html is visible:
<span class="cvIcon"><div style="display: none;" class="tooltip"><span class="ttCond">Shown if:</span> <span class="questionShortTooltip" title="Question 1">&nbsp;</span>Choice 2 </div></span>

The IsVisible() method  for HtmlSpan returns false  under IE 9.0 even i see that span is clearly visible on page. Under FF all is working as expected.
This span has  next computed styles under IE  if I use GetComputedStyle method: display:block, visibility: inherited

Under IE the styles look like on screnshot below


We use next hardware:
 OS: Win 7 x32/64
 Browser: IE 9.0
 Browser: Firefox 17.0.1
 TTF: 2012.2.122.12.4.0

Best regards,
Volodymyr
Tsvetko
Telerik team
 answered on 10 Jan 2013
2 answers
74 views
Hi,

Sometimes when I set the value of a HtmlInputFile the value isn't set and after the set timeout a TimeoutException is thrown. In order to give the upload enough ime I have to set the timeout to 2 minues, so the TimeoutException is thrown after 2 minutes even if the value wasn´t set.
Is there any way to check if the value was set before the timeout is over? Two minutes are a long time for a not working test.

That´s my current code:
while (string.IsNullOrEmpty(uploadField.Value)
{
try
{
uploadField.Upload(path, 120000);
}
catch (TimeoutException) { Thread.Sleep(1000); }
}


Thanks
Kind regards
Silvio
Top achievements
Rank 1
 answered on 02 Jan 2013
9 answers
141 views

Hello,

I am trying to use WebAii to control a WebApplication outside the context of the Testing Framework,
i.e., I am building a standalone application which uses WebAii, to control another application.
The problem is that I can't seem to control Silverlight controls from this standalone application.
When I run the same code within a TestMethod everything work.
Can you help me with this?

Many thanks in advance.

Jose Pacheco
Cody
Telerik team
 answered on 31 Dec 2012
1 answer
132 views
Hi, 

1) I was trying NUnit example below from (c:\Program Files (x86)\Telerik\Test Studio\Samples\Testing Framework\QuickStarts_NUnit_CS\) and added annotation. Annotation is moving as per code, but mouse not, it stays always on same spot. Any ideas? I have VS 2012 on 64bit win7, tried in IE9 and latest Chrome, project compiled as x86, .NET 4.0.
       
[Test]
        [Description("Use HtmlControls drag/drop native support")]
        public void HtmlElementsDragDropSupport()
        {
            // Slow down the execution a bit so we can easily observe WebAii doing the drags<br>
            Manager.Settings.ExecutionDelay = 100;
            Manager.Settings.AnnotateExecution = true;

            ActiveBrowser.NavigateTo("http://developer.yahoo.com/yui/examples/dragdrop/dd-basic_clean.html");<br>

            // get the window element we are trying to drag.
            HtmlDiv div1 = Find.ById<HtmlDiv>("dd-demo-1");
            HtmlDiv div2 = Find.ById<HtmlDiv>("dd-demo-2");
            HtmlDiv div3 = Find.ById<HtmlDiv>("dd-demo-3");
            //Move Div1 50 pixels to the right and 25 pixels to the top.
            div1.DragTo(50, -25);
            
            // Move Div2 to where Div3 is.
            div2.DragTo(div3);

            // Validate both locations are the same.
            Assert.AreEqual(div2.GetRectangle(), div3.GetRectangle());
        }

2) json2.js is missing and is referenced in project.

3) it seems any mouse action is not working:
// Open the popup using mouse click so it doesn't hang execution.           
Find.ByAttributes<HtmlInputButton>("type=button").MouseClick();

4) VS template examples fails on any call to e.g.: TestDeploymentDir, ActiveBrowser.NavigateTo(Path.Combine(TestContext.TestDeploymentDir, TESTPAGE));

Any ideas please? It looks like some configuration problem, even I had clean install of all tools.

 Thanks, David
Boyan Boev
Telerik team
 answered on 27 Dec 2012
6 answers
139 views
I am trying to use the WebAii API to automate an instance of Firefox 17.0.1

I've run the Telerik Test studio installer which seems to install the Firefox extension - I see the following listed under extensions:

'Telerik Testing Framework - Firefox Http Client 2012.2.1026.0'

However this version number does not sync with the version of the extension for the latest release that was installed to Chrome - this version of 2012.2.1204.0.

I tried manually installing the Firefox extension by zipping up the /Telerik/Test Studio/Browser Extensions/Chrome folder... renaming to .xpi, and then dragging/dropping to the Firefox extensions page - but the same version of the extenion is reported to be installed.

The real problem is that I cant execute a particular test with firefox.  The web application should follow a 302 redirect, but when using WebAii to automate this - the page just hangs at this step and eventually times out.  I'm also looking for troubleshooting steps to capture the WebAii log maybe?

thanks.
Boyan Boev
Telerik team
 answered on 27 Dec 2012
3 answers
151 views
I am running into an error on a simplistic use of ActiveBrowser that I cannot figure a way around.     

ActiveBrowser.RefreshDomTree();
  
FramesCollection framesCollection = ActiveBrowser.Frames;
  
int frameIndexWithSLApp = GetFrameIDwithSilverlightApp(framesCollection);
  
SilverlightAppsList listOfSLApps = framesCollection[frameIndexWithSLApp].SilverlightApps();
  
SilverlightApp SLApp = listOfSLApps[0];
The problem I am running into is that when the ActiveBrowser goes to Refresh the DOM the following error is received.  I can say the error seems to be intermittent and not reproducible every time. 

ArtOfTest.WebAii.Exceptions.ExecuteCommandException: ExecuteCommand failed!
BrowserCommand (Type:'Information',Info:'DocumentMarkup',Action:'NotSet',Target:'null',Data:'',ClientId:'Client_f0ec5086-cf9c-44b0-b74f-ae9735ccfad7',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'False',Response:'')
InnerException: System.InvalidOperationException: This client 'Client_f0ec5086-cf9c-44b0-b74f-ae9735ccfad7' is not connected to remote to be able to process command.
at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
---> System.InvalidOperationException: This client 'Client_f0ec5086-cf9c-44b0-b74f-ae9735ccfad7' is not connected to remote to be able to process command.
at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
--- End of inner exception stack trace ---
at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
at ArtOfTest.WebAii.Core.Browser.RefreshDomTree()
at Aprimo.Automation.Watin.Controllers.Concepts.Tools.WebAiiController.GrabSilverLightApp()

In addition to this exception I log a couple extra pieces of data:
What that ActiveBrowser.ClientId  and any open browsers the Manager sees.

ActiveBrowser ClientID: Client_14db7f05-c8e0-4b5d-adc0-f7581daef23a
Client_14db7f05-c8e0-4b5d-adc0-f7581daef23a - https://app.w.qa.marketingstudio.com/aprimoapp.aspx

Looking at the logging information I notice that the ActiveBrowser ClientID and the Manager's Open Browsers match up.  However, in the exception the ClientID is not matched. 

A little background on this test:
I have also ran tests against IE8 and IE9 and this error is only generated when running in IE9.  This occurred on both a 32 and 64 bit Windows 7 machines.  
We are using the build: Telerik_Testing_Framework_2012_2_1204_FREE_EDITION
During the execution, our web application generates popups (also browser pages) that appear, but I handle them with different code, Is it possible the ActiveBrowser switches to those, but when they are closed it doesn't switch back completely or possibly cached?

Any thoughts on this?

Thanks,

Will
Stoich
Telerik team
 answered on 25 Dec 2012
5 answers
729 views
I have a simple Nunit test runing,

 

 

 




[Test]
public void SampleWebAiiTest()
{
// Launch a browser instance
Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
// The active browser
ActiveBrowser.NavigateTo("http://localhost/HTMLTestpage.htm");
HtmlMainScreen homepage = new HtmlMainScreen(ActiveBrowser.Find);
homepage.TextField1.Text = "Automation Test";
homepage.OkButton.Click();
Assert.AreEqual("Automation Test", homepage.Div1.InnerText, "Elements are not equal");
}

HtmlMainScreen attached.

The test pass but I get the following exception. I am runing Visual Studio 2010 on Windows 7 (64bit) and using jetbrains resharper 7.0 to run the unit test

System.Threading.ThreadAbortException

Thread was being aborted.

at

ArtOfTest.WebAii.Messaging.Process.BrowserRemoted.AsyncListenerThreadEntry() at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

Plamen
Telerik team
 answered on 21 Dec 2012
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?