Telerik Forums
Testing Framework Forum
2 answers
121 views
Consider the following tests:

const string JS = "( function() { var ls = []; for(var i = 0; i < 10; i++) ls.push({ Key: \"key_\" + i, Value: \"value_\" + i }); return ls; } )();";
 
[TestMethod]
public void testJavascriptReturnsDictionaryIe() {
    Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
    var result = Actions.InvokeScript<Dictionary<string, string>>(JS);
}
 
[TestMethod]
public void testJavascriptReturnsDictionaryFirefox() {
    Manager.LaunchNewBrowser(BrowserType.FireFox);
    var result = Actions.InvokeScript<Dictionary<string, string>>(JS);
}
 
[TestMethod]
public void testJavascriptReturnsDictionaryChrome() {
    Manager.LaunchNewBrowser(BrowserType.Chrome);
    var result = Actions.InvokeScript<Dictionary<string, string>>(JS);
}

Chrome and IE return a Dictionary<string,string> properly. Firefox (I have version 21, with Firefox Http Client 2012.2.1205.0) throws an exception during InvokeScript:
Test method namespaced.TelerikTest.testJavascriptReturnsDictionaryFirefox threw exception:
System.Runtime.Serialization.SerializationException: The data contract type 'System.Runtime.Serialization.KeyValue`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' cannot be deserialized because the required data members 'Key, Value' were not found.
    at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ThrowMissingRequiredMembers(Object obj, XmlDictionaryString[] memberNames, Byte[] expectedElements, Byte[] requiredElements)
   at ReadKeyValueOfstringstringFromJson(XmlReaderDelegator, XmlObjectSerializerReadContextComplexJson, XmlDictionaryString, XmlDictionaryString[])
   at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadJsonValue(DataContract contract, XmlReaderDelegator reader, XmlObjectSerializerReadContextComplexJson context)
   at ReadArrayOfKeyValueOfstringstringFromJson(XmlReaderDelegator, XmlObjectSerializerReadContextComplexJson, XmlDictionaryString, XmlDictionaryString, CollectionDataContract)
   at System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadJsonValue(DataContract contract, XmlReaderDelegator reader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, ref DataContract dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
   at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
   at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
   at System.Runtime.Serialization.XmlObjectSerializer.InternalReadObject(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
   at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader)
   at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(Stream stream)
   at ArtOfTest.WebAii.Core.Actions.InvokeScript(String script)
   at namespaced.TelerikTest.testJavascriptReturnsDictionaryFirefox() in telerikTest.cs: line 139


Any help or resolution is appreciated. I'm trying not to need separate Javascript for each browser, because Testing Framework should abstract that for me. Thank you.
Connections Academy Developer
Top achievements
Rank 1
 answered on 13 Jun 2013
3 answers
114 views
Manager.Browsers.Count is not adding up even though the second browser instance opened up.

In automation on button click one more browser is opening up but the Browser count is still showing up as 1 instead of 2

Tried approaches as below

Manager.SetNewBrowserTracking(true);
Manager.Wait.For(browsers => Manager.Browsers.Count == 2, Manager.Browsers.Count, 100000);


Also tried with WaitUntilReady() , but still Browser count shows up as 1..

Any inputs??

Boyan Boev
Telerik team
 answered on 12 Jun 2013
1 answer
137 views
We need help in writing automated test scripts for testing Telerik Batch Update Grid. Our automation script fails while trying to enter values into text boxes on edit of the grid. Clicking on the cell of the grid does not open the text box when we use our automated script.

Would appreciate any help on this...

Our script looks like something like this...

driver.Click("/html/body/div[8]/div/form/table/tbody/tr/td[5]/span");
driver.Click("//form[@id='POLinesform']/table/tbody/tr/td[@id='LineNumber' and text()='1']/../td[@id='Warehouse']");
driver.ClearSendKeysWithName("Warehouse", testPo.warehouse);


Let me know if more information is needed.

Thanks
Cody
Telerik team
 answered on 11 Jun 2013
1 answer
103 views
Hi,

Quick question here, I was just wondering if the Telerik Testing Framework supported Mobile device websites.
Thanks
Cody
Telerik team
 answered on 10 Jun 2013
1 answer
83 views
Hi,

How to handle multiple modal dialogs?

On clicking a button in a modal dialog, it opens up another modal dialog.

 I'm not able to handle the new dialog that appears on clicking a button in the existing modal dialog. It's not connecting to the new modal dialog.


Thanks
Sudarshan






Boyan Boev
Telerik team
 answered on 04 Jun 2013
9 answers
1.1K+ views
Hi,

How to find elements in a wpf application?

I referred to the link below:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/write-tests-in-code/silverlight-test-automation/wpf-test-automation.aspx

I don't have the source code of the application or the element Properties, how can i find the elements in the application?

I was able to launch the application from visual studio using the coded step.

WpfApplication wpf = Manager.LaunchNewApplication(@"Application.APPREF-MS");

Application is launching but i'm not able to Find the elements In it.

Attached below the screenshot from Telerik Website.
How to Get the element Properties in the application? 

Thanks
Sudarshan



										
Plamen
Telerik team
 answered on 03 Jun 2013
4 answers
126 views
I am playing with the Telerik Testing Framework to compare it to Selenium, so we can decide if we will use it or Selenium moving forward. So far it seems to work well, and I have my first simple test case working great with IE. However when I run it with Firefox it fails, because when I submit the form on a page it returns immediately to my test code, while Firefox is still processing the submit in the background. With IE it does not do this, and waits until the submit has finished, and the site has rendered the resulting next page (which is the result of a redirect; it is testing our login page).

The code for the simple test is as follows:

// Browse to the login page
 
// Enter the user name and password
Find.ById<HtmlInputText>("UserName").Text = "UserName";
Find.ById<HtmlInputPassword>("Password").Text = _strongPassword;
 
// Now submit the form
Find.ByAttributes<HtmlInputSubmit>("value=Confirm").Click();
 
// Make sure we ended up on the categories page and the login succeeded
Assert.IsTrue(Browser.ContainsText("Categories / Products"));

The problem crops up with the Assert at the end. With IE, the test framework waits when the .Click() is done on the confirm button, and does not return until the resulting page has rendered. So then I can test for the content and it woks. With Firefox it returns immediately and the content in the browser is not correct since it has not yet changed, but the submit is being processed in the background.

I was trying to find out if there is a way to force it to wait after the submit to make it work with Firefox, but can't figure that out yet. But either way I think the test framework should be waiting on submit until the browser has settled and rendered the next page?
Boyan Boev
Telerik team
 answered on 31 May 2013
7 answers
196 views
I am attempting to select an item from a RadComboBox using the WebAii testing framework.  The combo box contains a list of state names where the drop down list is big enough to show 7 states at a time.  The following code is attempting to select "Wisconsin" from the combo box (radComboBox is an instance of RadComboBox in Telerik.WebAii.Controls.Xaml).
  • radComboBox.SelectItem("Wisconsin");
And is generating the following exception:
  • System.InvalidOperationException: Point (2220, 1624) outside bounds of browser window: (1797, 194, 1073, 717)
With the following stack trace:
  • ArtOfTest.WebAii.Silverlight.UserInteraction.ValidateMouseLocationIfNeeded(Point point)
  • ArtOfTest.WebAii.Silverlight.UserInteraction.Click(MouseClickType clickType, Point offsetPoint, OffsetReference reference)
  • Telerik.WebAii.Controls.Xaml.RadComboBox.SelectItem(String itemText, Boolean openDropDown)
  • Telerik.WebAii.Controls.Xaml.RadComboBox.SelectItem(String itemText)
  • <my call to SelectItem>
This same call will work for other combo boxes where the list contains 7 items or less.  Any clues for getting this to work would be greatly appreciated.  Thanks.

Joel
Cody
Telerik team
 answered on 31 May 2013
1 answer
71 views
To avoid issues with any plugins like RoboForm or others that might cause problems, and to ensure you have a clean slate when doing UI testing, it would be worth considering doing what Selenium does when it spawns Firefox. It uses the -profile command line option to spawn the Firefox used for testing with a completely fresh profile (and you can force a specific one if you wish with a config option). That way you know it won't get messed up by any other features or plugins. It would be really good if the Telerik tools could do the same thing:

firefox.exe -profile "E:\myprofile"

I also believe if you do this, it will spawn a brand new Firefox instance, so it won't interfere with an existing one that you might have running at the same time.

Not sure if this is at all possible with IE, but if it is possible with IE that would be a welcome addition there as well.
Mario
Telerik team
 answered on 30 May 2013
1 answer
95 views
Is there someway using telerik that I can take a screenshot of what is behind my form? Currently attempting this with regular wincontrols creates flicker that I don't want, and I was wondering if there was a control, property, or method that can achieve this for me?

Thanks!

Edit I forgot to mention that I am using winforms c#
Boyan Boev
Telerik team
 answered on 27 May 2013
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?