Verifiy link address on firefox
Hi, I am still exploring on how TestComplete works.
Currently, I am trying to create a test to verifiy the support link provided on the software opens the expected website address.
As I have limited knowledge on the scripting, I am using keyword test method. When I recorded the test and used property checkpoint on the address bar, for example, i want to verify that the website address is 'https://community.smartbear.com/', it didn't show any Text property, only caption, and it didn't work.
When I tried to run it, it shows warning message, 'The "Text" property of the "Stub object" object does not meet the checkpoint's condition',
I am not sure why the address bar on the firefox is considered as a Stub object.
Could anyone please help me how to verify website link inside the address search bar (I think it's a combobox)?
Thank you.
Kind regards,
Ran
lol ... no it was an example MyValue :smileyhappy:
So here you must make that,
function CheckWebURL(UrlToCheck) {
//Assuming that no need of browser exists check so just check if an url is given to be checked and if current browser current page url contains this url
if (typeof UrlToCheck == 'string') {
var posUrl = aqString.Find(Sys.Browser("*").Page("*").URL, UrlToCheck, 0 , false);
return ((UrlToCheck != "") && (posUrl >=0) && (posUrl < 9))
}
else {
Log.Message("UrlToCheck is incorrect");
return false;
}
}typeof return the type of the variable
it could be 'undefined', 'string', 'number' or 'Object' (array are included in Object)
Here you want a string, so checking if type is string is double check: variable is definied and it's type is string.
On your function, MyValue is here not defined ...
And it will return return true, because by default function returns true. And you don't specify the return value in case of bad type (Log.Message doesn't change return value, Log.Error yes).
Good place to learn data type here:
https://www.w3schools.com/js/js_datatypes.asp