UFT/QTP dynamical url - vbscript

i have this problem, an "url" has a "token" which generates a random number.
When i try to manipulate an object in this "url" during the run session, UFT doesn't recognize the object because the "url" change.
For example:
record::
Browser("url").Page("dynamicalUrl").WebButton("cancel").Click
'The url value of Page( "dynamicalUrl") is for example: https://example.com/token=542654364678
Run Session::
UFT crashes in the step, because it doesn't recognize objects and the url value of Page( "dynamicalUrl") changes to: https://example.com/token=987757858
Is there any solution to this?, if someone know how to solve this, thanks in advance.

if you only need the cancel button try to make the object dynamic
Use the spy to review properties and select the most appropriate ones.
Browser("index:=0").Page("name:=Page").WebButton("name:=Cancel")

There is no need to have any description for Page objects. Every Browser has only one Page, the reason UFT has this object at all is to create manageable object repositories.

Usually it is a Bad Practice to use the URL as a Page identififer. Try to use the title property instead.
In case you need the URL, use it as a Regular Expression. If your token is just numbers than the regexp is something like:
https://example.com/token=\d+
Generally speaking whatever is a dynamic part in a Property you need to use Regular Expressions for that

Related

How to recuperate field value in others forms in section template in Orbeon

I have a section Template'Section_library',in 'Section_library' i have a field 'first-name' who recuperate the value field from another section in my form so i used this expression
xxf:component-context()/root()/form/Section_TWO/mycontrol.
this expression not worked totally,the recuperation is done when i try to write in this field 'first-name'. i want a solution that automatically recuperate the value within any interaction of user.
I find this issue #3008 but i didn't understand it.
As of 2016.2, there is no reliable and supported way for code inside a section template to access information about the form it is used in. This is by design, but there are reasonable use cases that call for a section template being able to access things from the "outer form", and you're correct pointing to RFE 3008. For now I'd recommend you follow this issue.

MVC #Html.ValidationSummary Default Text

Is it possible to set any global defaults for use with the #Html.ValidationSummary?
We're using it throughout our solution and want it always to show the same text. For example, we can achieve the text as follows:
#Html.ValidationSummary(False, "Validation Errors Occured")
However, we want to avoid the developer needing to specify the text. Instead, we'd like them to simply code as follows:
#Html.ValidationSummary()
Not providing you exact answer you are looking but you can create new extension method as per your need for validation summary. and use that method across the site for validation summary. You will have more control on your create code.
Have a look at this post how James created new method for it.

Open phone call form with prefilled caller and direction using window.open

How could one open a phone call entity form so that direction is Incoming and that in "From" field there's a contact. I know already who is calling and I have the GUID. I know it's always contact. And I know that phone call is always incoming.
I have to use window.open function and pass those values in url. This site (https://msdn.microsoft.com/en-us/library/gg334375.aspx) does explain how to provide values for option sets and lookups, but in phone call "From" field is not a simple lookup but party list. And direction is not an option set but a Two options (if that makes any difference).
I have simply tried this
var extraqs = "directioncode=1&from=" + contactid;
window.open("https://myserver.crm4.dynamics.com/main.aspx?etn=phonecall&pagetype=entityrecord&extraqs=" + encodeURIComponent(extraqs));
but I can't get it work. I have tried to fiddle with those values back and forward and sometimes I get no error but it doesn't work either. Sometimes I get System.Web.HttpUnhandledException. I know it's probably because the format is off.
Another option I was thinkin that I could probably pass those values in url to the form and then create a function to form onLoad event where I could more easily set those field. But it sounds a workaround to me.
But my question is can I, and if how, set up those two fields?
A party list can not be set like a simple lookup.
Check out this blog post, it may guide you in setting party list
http://scaleablesolutions.com/open-new-activity-form-with-regarding-and-partylist-field-prefilled/

How to save property after tombstoning?

I have some property OwnerId that has each page in my application. I need these property to create HttpWebRequest and get some data. But when the application deactivated and activated again the page as deleted and created again, so these property is 0. I can't save these property in PhoneApplicationPage.State , because these property is different for different pages, so when I go twice back I can get error. I think to take it property after application activated from NavigationService.BackStack pages.But I'm not sure it is right. How can I do it ?
Aram .. thanks for explaining the question better.
Now, while your application is in the foreground, how are you managing all these different OwnerIDs? A collection? I am guessing you don't have multiple instances of the same page; but rather pass query parameters along to indicate which OwnerID/UserID should be used to display appropriate user info. You could put the whole collection in State dictionaries with a key & hydrate/dehydrate during the application lifecycle. Makes sense?
Thanks!
I'm not 100% clear on whether you need a setting for each page or just a single setting for the app. In either case your best option (IMO) is IsolatedStorageSettings (http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragesettings(v=vs.95).aspx)
If you just need a single setting then there's no problem but if you need one for each page you will need to do something ugly like using the page name as the key.

Automating filling Forms

Renting houses can be nasty so I need to automate it. Please, have a look at here. If you make a mistake, all of your changes are gone. I tried to insert the values in the url like:
https://www.hoas.fi/web/hak_inet.nsf/WebHakemus?OpenForm&02.07?PersonFirstName=Alex?PersonLastName=Smith
but it does not work. What is the problem?
Firstly, your query string is incorrect. It should be:
https://www.hoas.fi/web/hak_inet.nsf/WebHakemus?OpenForm&02.07&PersonFirstName=Alex&PersonLastName=Smith
Secondly, in order to pre-populate the page with the results of the query string, the developer of the page would have had to added logic to extract the query string values and pre-populate the page with those values. In this case, it does not appear that they have done that.
You could try saving the page locally as HTML. Then you could modify the HTML to include your default values. You would also need to update any relative paths to point to the server as a full URL. Then you could open the page on your machine and hopefully post to the server. This assumes that they are not injecting any session or other temporary information in the page that they validate.

Resources