We are trying to automate one of our desktop application using UFT but we are facing problem with telerik controls. UFT is unable to identify controls for eg • Custom DropDownList (Telerik.WinControls.UI.RadDropDownList) and 3rd party GridControl (Telerik.WinControls.UI.RadGridView) UFT not able to access.
Please tell me is it possible to automate telerik control using UFT or we need some additional setting for this ..
We can automate telrik controls using UFT. The biggest problem in doing so is that UFT does not know how to identify the objects and all of the objects will be identified as RAD controls.
You will have to write your own functions to execute tests on these controls. First you will have to find out which native function or property can be used for a particular control(this is a time consuming process), after that you will have to write your own function to either set the native property or call the native function to perform the operation on the control
Below is the example of what I will create in UFT for executing tests on telrik controls within UFT
Below is the example of such a function to set the text on telrik controls
'''This function will set the text for the telrik controls
'''OprObject is the reference of the object, name is the name string for the object to write the logs, object type will decide which native operation to be performed and value to be set is the actual value to be set
Public Function SetText(ByRef OprObject, ByVal ObjectName, Byval ObjectType, ByVal ValueToBeSet)
'''Check if the object is loaded
CheckLoaded(OprObject, true, ObjectName, ObjectType)
Select Case UCASE(ObjectType)
Case "COMBOBOX"
'''For RadComboBox this should work, not sure because I have only worked on a web based telrik app
OprObject.Object.Text = ValueToBeSet
Case "TEXTBOX"
'''' For Text Box we can just use
OprObject.Click
OprObject.Type ValueToBeSet
''' add other cases here
end select
End Function
To get the list of native functions and properties add the RadControl to the OR and then add the RadControl in your keyword view like below
Browser("").........RadObject("").Object.
Once you type . after the object you will see the list of properties and functions there (Make sure that your application is open and your object is visible inside the application).
You can also do this with object spy, but object spy wont give the complete list(sometimes you will have nested objects which will not be visible in object spy like RadControl.Object.Customer.Name, where name will not be visible in object spy and when you try to set something to customer in code UFT will throw error).
I wont recommend using insight objects here, because then you will just be automating your whole application as image and any changes in the application will break your tests.
Is object spy able to identify the objects? Is uft able to click on the dropdown list? If no, you can still use "Insight object" identification technique. ie identify the very image of an object... Also if it is java based u could try and enable the java plugin...let me know what worked
Related
I want to build a web page in plotly.js for plotting a mathematical function depending on some parameters. I want the user to be able to change it using a slider.
For doing this, I need to call my own javascript function (to recalculate the points of the graph), get the current value of the slider and update the graph.
I've looking at the examples in
https://plotly.com/javascript/sliders/
but none of them does what I need, and the documentation
at
https://plotly.com/javascript/reference/layout/sliders/
is not clear at all. It seems that I need to set the "method" property (also "args"). It says
"Sets the Plotly method to be called when the slider value is changed. If the skip method is used, the API slider will function as normal but will perform no API calls and will not bind automatically to state updates. This may be used to create a component interface and attach to slider events manually via JavaScript."
What does it mean?
I already have an application using plotly dash at
https://github.com/pdenapo/normal_bivariada/blob/main/normal_bivariada_interactiva.py
and it is very easy to do using #app.callback. However,
I want to do the same in javascript (since I want to run it on a web server, where I cannot run a python application).
¡Many thanks for any help!
I am trying to attach change event handler to the instance of kendoNumercTextBox.
I am able to get the instance of kendoNumercTextBox control using its ID, however Im not able to get the instance using class name
here is the code http://dojo.telerik.com/emIWa/11
NOTE
I DO NOT want to attach event handler at the time of instantiating
the control. I want to get the existing instance and then attach the
event handler.
Also i am actually using Kendo ASP.NET MVC, however
dojo doesn't allow me to write cshtml so i am using kendo UI for
the demo purpose above. But i think end result would be same.
The NumericTextBox is created like below in cshtml
#(Html.Kendo().NumericTextBoxFor(x =>x.numerictextbox).HtmlAttributes(new {#class = "MyClass"}))
You need to use a more specific jQuery selector. This for example will get the correct element which is the one with the data-role attribute:
var numerictextboxByClassName = $(".MyClass [data-role]")
If you use the developer tools in your browser to inspect the text box, you'll see that 'MyClass' is on several elements that comprise the widget, hence the need to be more specific. It is also worth noting that the handler will only attach to the first instance found using the selector so this method cannot be used to attach a handler to several such controls at the same time.
Using c++ builder borland (bcb6).
I wish to invoke manually button click event. I did:
FMap->bbDoneInClick(NULL);
While Done button located on the FMap form, but something went wrong with that.
Do I need to call bbDoneInClick with different parameters and not with NULL ?
Instead of NULL use the Form1 or the bbDone itself ...
it depends on the event code itself how it uses the Sender parameter
Also you can call the event handler safely only if the form is already created
if it does not access Canvas you can use it even in TForm1::TForm1 constructor
if it does you need to take care of not using it prior to OnShow or OnActivate
to avoid VCL problems or App crashes
for common handlers it is sufficient to use main window ... (I use this instead of NULL)
if you have single even handler for multiple components then the even is usually deciding the operation or target from the Sender parameter so in that case you need to pass the pointer to component itself
I have a dialog in vb6 which changes the values being displayed in its parent dialog.
The x1 is displayed in txt_c1 text in parent dialog and it has a txt_1validate function too for the text box. Now i want to change the value of txt_c1 txtbox from child dialog and then call its validate function. But the problem is that txt_c1 is not available in child dialog.
Please note that i am working in vb6 in the MS VB 6.0 IDE
Forms are just classes and can therefore be instantiated explictly (and you will probably find your life easier if you do rather than using the automatic instantiation in VB6) and references to forms can be assigned.
You can solve your problem by creating a public property on your child dialog (Form1.frm) of type Form that you set to the instance of the parent dialog thus giving you access to the controls andd methods on the parent from the child.
My VB6 is somewhat rusty (and I don't have an installed instance available) so this isn't going to be actual, correct code - but something along the lines of the following should work
In the code that calls the child:
Form childDialog = new Form1
childDialog.Parent = this
childDialog.ShowModal
Then in the child dialog:
Parent.txt_c1 = newValue
if not Parent.Validate then
...
end if
I am using DevExpress controls in a winform app I am building for internal use. My app has about 30 forms in total and I am trying to figure out a way to allow my user's to select a theme. I have seen this mentioned here at SO multiple times in answers to other posts.
I understand how the StyleController works, I believe, but what I am wondering is how I can use 1 Style controller for the whole app.
Right now I am trying to create 1 StlyeController at the Shell form and then pass a reference to it to each child form. From there I then have to programatically set the StyleController property for each control. I don't mind I just wonder, especially from those who have done this, if there is a simpler way?
It is very simple. This example is assuming that you are using skins.
In the constructor of your main form calls:
DevExpress.Skins.SkinManager.EnableFormSkins();
This will enable your form to use the current skin. It is also important that each of your forms derived from XtraForm.
After that you need to setup the global look and feel object for your application:
//This set the style to use skin technology
DevExpress.LookAndFeel.UserLookAndFeel.Default.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
//Here we specify the skin to use by its name
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Black");
If you want to set the look and feel of your application like Office 2003, the setup is different. You just have to call the following function:
DevExpress.LookAndFeel.UserLookAndFeel.Default.SetOffice2003Style();
So, every control of devexpress will use these settings to paint themselves. It is possible to specify a custom LookAndFeel object for some controls but I never used it because I dont see the point to have a custom display for a control or a form.
Exception:
There is one exception in Devexpress framework. The NavBarControl does not use the skin technology automatically from your global LookAndFeel object, you need to specify a setting to enable that:
//To use the current skin
youNavBarControl.PaintStyleName = "SkinNavigationPane";
//To use the current look and feel without the skin
youNavBarControl.PaintStyleName = "NavigationPane";
With version 11.2 I used the information in this article:
http://www.devexpress.com/Support/Center/p/K18013.aspx
In summary :
* Inherit all your forms from XtraForm
* Leave look and feel settings default so that they use the default skin
* Modify the default skin with the following line of code:
DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "DevExpress Dark Style";