Not able to uniquely identify a checkbox in qtp - vbscript

I am working on a windows form .Net application using QTP and there are a set of checkboxes which are repeated and all have the same property.I need to select the one particular checkbox from each set.If the checkbox is not visible on the screen then we need to scrool down else in pops a error message.Is there a way to select one particular checkbox from each set.
eq:
abc feature
1
2
3
abc feature
1
2
3
4
abc feature
1
2
i need to select checkbox 1 from all the set.

You need to find a way to identify a "checkbox set" use the object spy or a dom inspector to see what identifies the set (probably some kind of div or span) for the sake of this answer I'll assume that it's a div with a specific class "chkbxGrp".
Then look for the first checkbox contained within this group and check it.
Note that scrolling the checkboxs into view is done automatically by QTP.
If you need to fail this when an expected group doesn't exist you will have to find out how to identify specific groups and then use the expected values in the test rather than iterating over all such groups.
' Untested code
Set Desc = Description.Create()
Desc("html tag").Value = "div"
Desc("html tag").RegularExpression = False
Desc("class").Value = "chkbxGrp"
' Find all groups
Set groups = Browser("B").Page("P").ChildObjects(Desc)
For i = 0 To groups.Count -1
' in each group check the first checkbox
groups(i).WebCheckBox("index:=0").Set "ON"
Next

You can "identify" the checkbox using QTP index.
It's not the best option to do, though if you need only the 1st checkbox.
Just look for all Objects on the page of a type "CheckBox", and if the result set > 0, get the first one.
The second option is to "locate" the Checkbox by the nearby elements, but in this case you need to be sure that their location is NOT to be changed.
BTW, are you sure they are completely identical? In QTP there is an option to set necessary attributes for elements location. You can add any attribute which is unique for the CheckBoxes appearing in your app.

Related

How to deselect all items in a combobox?

I have a drop down combobox that I need to deselect all of the options in there.
I've tried selecting every item using the select option and making it equal to false, it's not working, I also tried doing the same with getItem.
For It = 1 To wpfwindow("window").WpfComboBox("randComboBox").GetItemsCount -1
wpfwindow("window").WpfComboBox("randComboBox").select(It) = false
I want everything to be deselected
I don't think WpfComboBox supports having no element selected. From a look at the documentation of WpfComboBox.Select I see two problems with your code.
(major) Select selects an item, it doesn't return a boolean saying whether it's selected, so settign it to false won't do anything.
(minor) It says that The first item in a list is numbered 0 so starting It with 1 is an error (if you start with one you should end with GetItemsCount not with GetItemsCount-1).

How to click on Web Table column's Web Button in following case?

I have one web table, in this I want to delete particular record by clicking on record's delete button.
I got the value of row but I am not able to perform click on web button of particular row and also there is 2 buttons in one column.
How to click on delete icon of particular row?
You need to set a reference to the item within the specific row and then click on it - something like this:
Set oLink = Browser("myBrowser").Page("myPage").WebTable("myTable").ChildItem(iRow,8,"Link",0)
oLink.Click
You will potentially need to amend the "Link" and the number 8 in your own code. iRow represents the row you are trying to interact with.
Essentially what this code does is set an object reference to the first item of type "Link", in column 8 of the table, then uses a Click event to select it. If your delete icon is a WebButton, then replace "Link" with "WebButton" for example. The final 0 in the command tells UFT to select the first element matching the object type - you might need 1 if your two icons are in the same column of the table.
Let me know if that helped.

Tableau dashboard action unresponsive

Workbook is on Public Tableau
I'm using one drop-down, which is a calculated value (refer previous question) to control map, and two worksheets.
When I toggle through the filter, only the relevant location appears on map, while the other two worsheets do not change, i.e. they show all locations.
How to fix this?
Thanks once again!
To get tableau Action revealed on another data.
Step1
Go to Dashboard > Click on icon dashboard > Click on Action > Select Add Action > Filter and follow further steps as per given as
Step2
Click ok in action and you will get desired results
Step3
In your Dashboard Filter which is
select the icon and follow steps further which is describe below :
This will get desired results as per your requirement.
Result: your result will look like this example as given as
You can't filter multiple worksheets with a table calculation (your intuition about why is exactly right). BUT we can do something sneaky again.
First, create a parameter to replace your quick filter. Let's call it "Choose Location". Make the data type "String", then select "List" from Allowable Values. Go to "Add from Field" and select "Location (Loc)". Your parameter will now allow you to select from a list of all the different values of [Location (Loc)].
Since you want to be able to show all of the locations at once, also add "All Locations" to the parameter's list of allowable values (I put it at the top of the list because that's what my heart said to do).
Next, create a calculated field. Let's call it "Choose Location Filter".
IIF([Choose Location] = "All Locations", TRUE, [Choose Location] = [Location Filter])
This statement will return TRUE if the Location on the given row of the partition is equal to the Location selected in the parameter and FALSE otherwise. If you've selected "Multiple Locations", it will return TRUE for all rows. Note that we're still using the [Location Filter] that you made so that we can maintain all locations in our partition and calculate that Grade.
Now, in every worksheet, replace the [Location Filter] in your filter card with the [Choose Location Filter] field. Filter out the FALSEs, leaving only the TRUEs. Place the parameter control on your dashboard and use that to filter instead of the quick filter you built previously.

Enable/Disable APEX dynamic action

I have a form which has 4 items:
A yes or no fill in
2 items if yes
1 item if no
I would like to create a dynamic action that would disable the field(s) that I do not need, enable the one(s) that I do need, and set the focus to the (first) enabled item. Additionally, it should be able to switch back and forth without a page refresh.
I tried making a couple of dynamic actions, but I noticed that it would only change once. For example, if I were to enter 'yes' into the first field, it would enable and disable the appropriate fields, but when I would switch the first field to 'no', nothing would changed.
Any help would be greatly appreciated. Thanks in advance.
It sounds like you need to fill in the Condition field (in the When sction) on the dynamic action and then include a True Action and a False Action.
For example:
Condition equal to 'Yes'
True Actions: Display 2 items
Hide 1 item
False Actions: Hide 2 items
Display 1 item
If this doesn't resolve your issue, you should try listing the values you have used for all the fields on your dynamic actions. Without seeing the values, it is difficult to troubleshoot.

How to design this page in razor world

In MVC-3/Razor, I need to create a page which will have five set of controls. Each set will have a drop-down and a text box. User will select an option from drop-down and then provide some feedback on text box.
When the view is shown very first time, I only have to enable controls in first set. Whereas all controls in 4 other sets should be disabled. Once user perform action in first set of controls (select optino from drop-down and enter in text box), the second set should become enable now, whereas other set of controls should still be disbaled. The data shown in this second drop-down is dependent upon what user has selected in first drop-down. Once user complete action in this second set, the data in third drop-down will depend upon whatever user selected in first and second drop-down etc.
I am a web-form aspx developer and not sure what will be the best way of designing this in MVC-razor world (because there is not view state etc).
Step 1)
What needs to be clarified is what will cause the other “sets” to be enabled?
Is it after the user has selected an item in the dropdown
OR
Is it after they have entered some text in the textbox?
What also needs to be clarified is if you have a dropdown AND a textbox are they both enabled at the same time or is the textbox only enabled after you’ve selected an item in the dropdown?
Once you’ve got that figured out, move on to the next step.
Step 2)
Do the users need to visually see the 4 sets from the beginning (disabling the 3 other sets) or can you simply show the other sets (on the fly) once the previous one has been successfully filled?
Depending on the answers, this may vary your approach.
As for me, the way I’d do it is simply have/show one set that loads at the beginning.
Once the user has selected an item from the dropdown, I would make an AJAX call passing along the selected item and get back a list of values for the second dropdown.
Then, using jQuery, I would duplicate the row (or div) of the first set all while changing the values in the second dropdown box.
Repeat process for when an item is selected in the second dropdown.
But wait! There’s more!!!
Let’s assume you’ve reached the third set. What if the user decides to change the value in the first dropdown? What are your requirements if that happens? Should you remove all other sets and start back at square one? I guess so…
Since we are not aware of the full set of specs for your tasks, we can only assume stuff and this may (or not) be the best path to take.
Duplicating a row (or a div) using jQuery is quite fun and performance wise, it’s nice.
Keep in mind, you will have to give a different ID to your controls (dropdown + textbox) so when you submit the form, you could use the FormCollection to get those dynamically generated controls.

Resources