Telerik Forums
Testing Framework Forum
1 answer
133 views
Hi Guys, 

Pls refer to the attached image. 
Since the value of the txt is currently '7', the following will work with no issues: 
 Manager.ActiveBrowser.Find.ByContent<HtmlAnchor>("7").Click();

The thing is, the value ("7")  may change but I still want to click the same link. 
 As the id of an element may change from time to time, it's not a good practice to use Elements IDs...
 Manager.ActiveBrowser.Find.ById<HtmlAnchor>("dashboardForm:appAll").Click(); 

I've tried several other methods under Find and was not successful...
Manager.ActiveBrowser.Find.ByAttributes<HtmlAnchor>("value=all").Click();

Could you pls indicate what is is the preferred Find method to use if I wanted to find & click that link by it's Value (value= 'All') ?

Ta, 
SD. 






Nikolai
Telerik team
 answered on 01 Jun 2010
2 answers
132 views
Hi Guys,

I've got a menu button which will only 'revel' itself once you hover about the text ('Search'). 
Hovering above search will show 'General Search' that can be clicked to move to the relevant page. 

I'm already using declarations like  Manager.ActiveBrowser.Find.ByName<HtmlInputSubmit>("submit").Click(); 
and was wondering what is the appropriate element to use in my case. 
Ta,
SD. 

<div id="menuForm:searchMenu"  class="dr-menu-label rich-ddmenu-label dr-menu-label-unselect rich-ddmenu-label-unselect" > 
<span id="menuForm:searchMenu_span"  class="dr-label-text-decor rich-label-text-decor" >Search</span> 
<div style="border: 0px none ; margin: 0px; padding: 0px; position: relative; z-index: 100;" > 
<div id="menuForm:searchMenu_menu"  class="dr-menu-list-border rich-menu-list-border"  style="visibility: hidden; z-index: 2; left: -6px; top: 3px; width: 150px;" > 
<div class="dr-menu-list-bg rich-menu-list-bg" > 
<div id="menuForm:_id28"  class="dr-menu-item rich-menu-item dr-menu-item-enabled rich-menu-item-enabled"  onmouseup="Event.stop(event); "  onclick="; ;"  style="" > 
<span id="menuForm:_id28:icon"  class="dr-menu-icon rich-menu-item-icon" > 
<img height="16"  width="16"  src="/webInt/spring/a4j_3_1_6.GAimages/spacer.gif" /> 
</span> 
<span id="menuForm:_id28:anchor"  class="rich-menu-item-label" > 
<id="menuForm:generalSearch"  onclick="clearFormHiddenParams_menuForm('menuForm');document.forms['menuForm']['menuForm:_idcl'].value='menuForm:generalSearch'; document.forms['menuForm'].submit(); return false;"  href="#" > 
General Search 
<script type="text/javascript" ></script
</a> 
</span> 
</div> 
<div class="dr-menu-list-strut rich-menu-list-strut" ></div
</div> 
</div> 
<script id="menuForm:searchMenu_menu_script"  type="text/javascript" ></script
</div> 
</div> 

SD
Top achievements
Rank 1
 answered on 31 May 2010
5 answers
144 views
I am running my test suite against IE, but one test has a bug that surfaces in IE only. I don't expect it to be fixed soon, so I want to force that one test to run against Firefox. Is there a clean way to do that? I tried adding a coded step that does the following:

Manager.Settings.DefaultBrowser =

BrowserType.FireFox;

 


But the browser is launched before the first step is executed, so I need to intervene earlier. This is not a unit test, so I don't have a test setup method at my disposal. I see that BaseWebAiiTest has a CleanUp() virtual method, but there is no corresponding SetUp().

My other thought was using a separate test list for that one test, along with a special testrunconfig file that specifies Firefox as the default browser. But I'm uncertain how to easily make that work in a TFS build - because there can be only one testrunconfig in a build, I believe I'd have to create a separate build definition for each browser.

Anyone know an easier way?
Konstantin Petkov
Telerik team
 answered on 26 May 2010
3 answers
125 views
Hi all,
I'm a newbie in Webaii. I have just researched this tool in 2 weeks. I met an issue here. I log to one page, it will displayed a modal dialog for inputting username and password. i can't catch ID or name of these two text box for input text. I try a lot of way but it still no affect. Please help me this.
Please see attachment "dialog.jpg" for more details.

Thanks.
Missing User
 answered on 25 May 2010
5 answers
170 views
We're developing a test framework around WebAii and we're consistently getting the following error when doing HtmlControl.Click(false). I've seen a couple other posts related to this error but neither cure our problem. Unfortunately it's going to be a bit tricky to produce a concise repro as it's all embedded within a larger framework.

Anyone seen this before and have a solution?

Thanks,
Matt

Error
ArtOfTest.WebAii.Exceptions.ExecuteCommandException: ExecuteCommand failed!
InError set by the client. Client Error:
System.IndexOutOfRangeException: Current frame index '0' is out of range of current frames count '0'
   at ArtOfTest.InternetExplorer.IECommandProcessor.SetTargetDocument(BrowserCommand& request, IHTMLDocument2 document)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)
BrowserCommand (Type:'Information',Info:'DocumentMarkup',Action:'NotSet',Target:'null',Data:'',ClientId:'Client_74853fed-16ca-4b7b-8fbf-396393255c7c',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'0',InError:'True',Response:'System.IndexOutOfRangeException: Current frame index '0' is out of range of current frames count '0'
   at ArtOfTest.InternetExplorer.IECommandProcessor.SetTargetDocument(BrowserCommand& request, IHTMLDocument2 document)
   at ArtOfTest.InternetExplorer.IECommandProcessor.ProcessCommand(WebBrowserClass ieInstance, BrowserCommand request, IHTMLDocument2 document)')
InnerException: none.

Stack trace
ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
ArtOfTest.WebAii.Core.Browser.RefreshDomTree()
ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request)
ArtOfTest.WebAii.Core.Actions.Click(Element targetElement)
ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl.Click()
<our code>
Missing User
 answered on 25 May 2010
2 answers
74 views
Hi,

With any test I create, whenever I try to run using the Quick Execute button I get the following error

--------------------------------------------------
'17/05/2010 16:26:18' - Error encountered during execution.
--------------------------------------------------
'17/05/2010 16:26:18' - Error attempting to ping runner. Error: System.ObjectDisposedException: Cannot access a closed pipe.
   at System.IO.__Error.PipeNotOpen()
   at System.IO.Pipes.PipeStream.CheckWriteOperations()
   at System.IO.Pipes.PipeStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at ArtOfTest.WebAii.Messaging.Process.PipeCommunication.WriteCommandToPipe(PipeCommand command, PipeStream pipe, Boolean waitForDrain)
   at ArtOfTest.WebAii.Design.Execution.RunnerController.Ping()
--------------------------------------------------
'17/05/2010 16:26:18' - Aborting....

This happens when trying to launch using IE, Firefox or safari. I can run test fine using Test view -> run

Any ideas?

Cheers,

Matt
Cody
Telerik team
 answered on 20 May 2010
1 answer
87 views
When WebAii decides it needs to scroll the window to interact with a silverlight element, it doesn't refresh the silverlight element locations. I've tried calling Refresh on the DOM VisualTree and the SilverlightApp VisualTree. The only thing that seems to work is calling SilverlightApps() again (after refreshing the DOM). Any other ways to solve this problem?

Manager.ActiveBrowser.RefreshDomTree();

SilverlightApp testGame = Manager.ActiveBrowser.Frames.ById(WebAiiPageElements.GAME_FRAMEID).SilverlightApps()[0]; 

 

Missing User
 answered on 17 May 2010
3 answers
109 views
I would like to know witch are the minimal requirements for WebUI For developers?
also i am interested on witch of Visual studio products (see below list ), WebUI can be plugged-in?

list:  Visual Studio Professional
       Visual Studio Ultimate
       Visual Studio Premium


thank you in advance
Christopher
Telerik team
 answered on 17 May 2010
7 answers
841 views
Hi Guys,

Apologies for asking the same question again but I think I was not clear enough in the previous time: 
Using the WebAii Nunit template, I've got 2 separate CS. files. One file contains tests that call helper methods from the other. 

The file that contains the tests:

namespace MyTests
{
    [TestFixture]
    public class TestCase_Login : BaseTest
    {
        Paths Path = new Paths ();

        [Test]
        public void LoginBase()
        {
            Path.baseLogin(); 
        }
    }
}
The other file that contains the helper methods:

namespace Helpers
{
    class Paths : BaseTest
    {
        public void baseLogin()
        {
            Manager.LaunchNewBrowser(BrowserType.FireFox);
            Manager.SetNewBrowserTracking(true);
            ActiveBrowser.NavigateTo(Manager.Settings.BaseUrl);
            Manager.ActiveBrowser.WaitUntilReady();
        }
    }
}

Trying to run the test will result: 

System.NullReferenceException: Object reference not set to an instance of an object.


I understand that there is no testsetup run for the Paths class so the inherited BaseTest Manager objectis not instantiated and is not settable to the outer class' Manager referencesince the BaseTest Manager reference is read only.


As I want to keep the helper methods in a separate cs. file, could please advice how should I create a private manager property for 

the Paths class (And similar classes) and how to pass the outer class manager in the constructor in order to be able to use a single instantiated Manager object to be used in the different helper classes. 

 


Thanks in advance, 

SD. 









SD
Top achievements
Rank 1
 answered on 14 May 2010
3 answers
234 views

I need to write a step with conditional logic. According to the user guide, this requires a code-behind method. I'm having a problem handling a confirmation dialog within the code-behind method: the dialog does not get dismissed, and the test fails with a timeout.

I have a pure WebAii test that handles the same confirmation successfully, so I generated a unit test from that and copied the dialog manager code you see below. Is this the wrong technique for use in a code-behind?

        [CodedStep(@"Delete customer record if it exists")]  
        public void DeleteCustomerIfExists()  
        {  
            string emailAddress = "abc@xyz.com";  
 
            Pages.CustomerSearch.SearchFor.Text = emailAddress;  
            Pages.CustomerSearch.SearchButton.Click(false);  
 
            HtmlAnchor customerLink = Find.ByAttributes<HtmlAnchor>("title=" + emailAddress);  
            if (customerLink != null)  
            {  
                // Handle 'Confirm' dialog.  
                ConfirmDialog confirmDialog = new ConfirmDialog(ActiveBrowser, DialogButton.OK);  
                Manager.DialogMonitor.AddDialog(confirmDialog);  
 
                // this displays confirmation dialog  
                Pages.CustomerSearch.DeleteCustomerButton.Click(false);  
 
                confirmDialog.WaitUntilHandled(5000);  
            }  
        } 

Thanks!

Missing User
 answered on 13 May 2010
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?