I am trying to click a menu items in a span as attached in a screenshot. The same below code to find an item by XPath works in selenium but not in telerik testing framework. Can some one tell me why?
--Telerik Code that does not work. Gives null menu.
Element menu = myManager.ActiveBrowser.Find.ByXPath("//span[contains(text(),'some text')]");
myManager.ActiveBrowser.Actions.Click(menu);
---Selenium code that works.
driver.FindElement(By.XPath("//span[contains(text(),'some text')]")).Click();
I'm trying to simply open a project using the stand alone application via git. Clicking on Test Studio>Open directs me to the location in which my project files are listed but no matter what I select, it just takes me to the end of the file without opening anything.
Attempts to open using source control are also unsucessful via git. WHen asked to browse for folder ... it's the same result but this time ending in "folder already exists and is not an empty directory". Creating a new folder does nothing, just says "Git Source Control: Error connecting to Git repository: Request failed with status code: 401". But yet it says I'm already connected to the repository. What am I missing here? Apparently i can only open Recently worked on or viewed projects.
Hello,
I am doing research on web automation. I have found Testing Framework during my research. I have tested it using ASP.NET and it is working sometime on development and it was throwing error sometime also when I hosted this site on IIS it was not working completely.
Can anybody help me please how to configure application on IIS?
Does it work on IIS?
Below code is working for Chrome only. It is not working on IE and Firefox
Settings settings = new Settings();
settings.Web.DefaultBrowser = BrowserType.Chrome;
Manager manager = new Manager(settings);
manager.Start();
manager.LaunchNewBrowser();
manager.ActiveBrowser.NavigateTo("http://www.google.com");
Please help.
Thanks,
Bhavin Panchal
Hi,
After updating to the newest version of Telerik Testing Framework new automation IDs are not recognised. The old ones (created before the update) work, but the new ones that I have added are not recognised and when the tests are run and I recieve an "element not found" error.
I think I am adding in the ID correctly (this is how I always used to add them in before). Please see the example below:
What is written in the Xaml:
<ListBox AutomationProperties.AutomationId=
"Menu_Model_Type_ListBox"
Height=
"Auto"
MaxWidth=
"250"
ScrollViewer.HorizontalScrollBarVisibility=
"Disabled"
ScrollViewer.VerticalScrollBarVisibility=
"Disabled"
HorizontalAlignment=
"Stretch"
ItemsSource=
"{Binding ModelTypes}"
>
<ListBox.ItemTemplate>.....
What is written in the Test:
ArtOfTest.WebAii.Controls.Xaml.Wpf.ListBox modelTypeListBox =
app.MainWindow.Find.ByAutomationId<ArtOfTest.WebAii.Controls.Xaml.Wpf.ListBox>(
"Menu_Model_Type_ListBox"
);
Any idea what could be causing this error? These elements are definitely there (and of the correct type etc.).
Many thanks in advance for your help.
Best regards,
David
RadMaskedTextInput: how to insert value in it using Test Studio, I need to raise the valuechanged event so that other button on UI will be enabled.
Thanks,
Kanwar
Hello!
Is it possible to retrieve the instance of the DataContext of a UserControl within a WPF Application?
I have tried it with FrameworkElement.DataContextProperty, but FrameworkElement.GetProperty(FrameworkElement.DataContextProperty) just get's the FullName of the DataContext as a string.
I am working with VS2015, .NET Framework 4.5.2, MSTest (switching to MSTest V2 once no longer a prerelease).
Here's my example code of a MVVM WPF-Application:
Default App.xaml and App.xaml.cs, with StartupUri="MainWindow.xaml"
Command and ViewModel, see http://docs.telerik.com/data-access/quick-start-scenarios/wpf/quickstart-wpf-viewmodelbase-and-relaycommand#implementing-viewmodelbase-and-relaycommand.
MainWindow.xaml: (default Code-Behind)
<
Window
x:Class
=
"WpfApplication.MainWindow"
xmlns:local
=
"clr-namespace:WpfApplication"
mc:Ignorable
=
"d"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
local:MyUserControl
AutomationProperties.AutomationId
=
"UserControlId"
/>
</
Grid
>
</
Window
>
MyUserControl.xaml: (default Code-Behind)
<
UserControl
x:Class
=
"WpfApplication.MyUserControl"
xmlns:local
=
"clr-namespace:WpfApplication"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"300"
>
<
UserControl.DataContext
>
<
local:MyDataContext
/>
</
UserControl.DataContext
>
<
Grid
>
<
StackPanel
>
<
Button
AutomationProperties.AutomationId
=
"ButtonId"
Content
=
"Click"
Command
=
"{Binding ClickCommand}"
CommandParameter
=
"{Binding ClickCommandParameter}"
/>
</
StackPanel
>
</
Grid
>
</
UserControl
>
MyDataContext:
using
System.Windows.Input;
namespace
WpfApplication
{
public
class
MyDataContext : ViewModel
{
public
ICommand ClickCommand {
get
; }
public
string
ClickCommandParameter {
get
; } =
"clicked"
;
public
int
Count {
get
;
private
set
; }
internal
MyDataContext()
{
ClickCommand =
new
Command(OnClick);
}
private
void
OnClick(
object
obj)
{
Count++;
}
}
}
Unit Test (MSTest):
using
System.IO;
using
ArtOfTest.WebAii.Core;
using
ArtOfTest.WebAii.Silverlight;
using
ArtOfTest.WebAii.TestTemplates;
using
Microsoft.VisualStudio.TestTools.UnitTesting;
using
WpfApplication;
namespace
UnitTests
{
[TestClass]
public
class
MyUnitTests : BaseWpfTest
{
public
TestContext TestContext {
get
;
set
; }
[TestInitialize]
public
void
MyTestInitialize()
{
Initialize();
string
currentWorkingDirectory = Directory.GetCurrentDirectory();
string
path = Path.Combine(currentWorkingDirectory,
".."
,
".."
,
".."
,
"WpfApplication"
,
"bin"
,
"Debug"
,
"WpfApplication.exe"
);
Manager.LaunchNewApplication(path);
}
[TestCleanup]
public
void
MyTestCleanup()
{
CleanUp();
}
[TestMethod]
public
void
MyTestMethod()
{
FrameworkElement userControl = ActiveApplication.MainWindow.Find.ByAutomationId(
"UserControlId"
);
FrameworkElement button = userControl.Find.ByAutomationId(
"ButtonId"
);
Assert.AreEqual(
"Click"
, button.GetProperty(
new
AutomationProperty(
"Content"
,
typeof
(
string
))));
Assert.AreEqual(
"WpfApplication.Command"
, button.GetProperty(
new
AutomationProperty(
"Command"
,
typeof
(
string
))));
Assert.AreEqual(
"clicked"
, button.GetProperty(
new
AutomationProperty(
"CommandParameter"
,
typeof
(
string
))));
button.User.Click();
object
dataContext = userControl.GetProperty(FrameworkElement.DataContextProperty);
Assert.AreEqual(
"WpfApplication.MyDataContext"
, dataContext);
//pass
Assert.IsInstanceOfType(dataContext,
typeof
(MyDataContext),
"''"
+ dataContext +
"''"
);
//fail
}
}
}
And are there any other ways to get and/or set a Property of a ViewModel alternatively?
From the code sample above, I would like to get the current value of MyDataContext.Count.
In my Unit Test, I want to Assert the incremented MyDataContext.Count property after each Button-Click.
Best wishes!
Hello!
Is there a way to verify that e.g. a Mouse-Click via FrameworkElement.User.Click() throws a particular exception within a WPF Application?
Check within a Unit Test via e.g. MSTest's ExpectedExceptionAttribute or NUnit's Assert.Throws?
Best wishes!
Hi,
I am trying to create a multilevel test for entering 100 records for a Client profile table through 3 different pages(each having some 30-40 fields) in a sequence.
Scenario (created a driver script for this) -
1. Login and initialize application
2. Call Test A (parent test - data bound to 100 records in excel)
3. Logout
Steps in Test A
1. Enter data in Page1 and continue to Pg2(Test B1)
2. Enter data in Page2 and continue to Pg3(Test B2)
3. Enter data in Page3 and continue to Pg4(Test B3)
4. Enter data in Page4 and continue to Pg4(Test B4)
5. Enter data in Page5 and save record(Test B5)
6. Navigate back to Page 1 for next iteration
My issue is:
1. Data for Test B1, B2 .. B5 are in 5 different sheets in excel. And I can bind the parent TestA to only one sheet at a time. So I consolidated all of them into one sheet. Is there any other solution to this?
2. InheritParentDatasource set to True for Tests B1-B5. Even after binding all the variable manually in the child tests, they are not entering the values from the parent table when the test is run
eg- Enter text in "ClientProfilePersonNameBirthNameTest" - DataDriven : [$(BirthName)] is shown when I bind the step in Test B1 to the BirthName variable coming from TestA but it doesn't actually enter that value during runtime. Iteration 1 in runtime log shows the value in this variable so its available to Test B1
Can you tell what the issue might be?
Thanks