Forum Discussion
Hi Morten,
The ODT feature wasn't reinstated in TestComplete 10.5. Our Product Management is aware of the fact that many of our customers are requesting to return this feature back. So, they consider this in future. However, right now, you will need to contact our Support team to get the ODT modules for TestComplete 10.5.
- rrivest10 years agoContributor
Where I'm currently working, we managed to replicate OO design without using ODT in C#.
Here's a sample "Browser" class that allowes to instantiate either a standard browser or a virtual device for mobile web.
We simply expose the methods and properties as needed
function Fureteur()
{
// Initialisation des FIELDS
this.Component = Object(); // L'object TestComplete.Browser
this.BrowserType = varInteger; // Le type de Browser (int, -1=IE, -2=FF, -3=Chrome)
this.currentPage = Object(); // Object de type Page, Page courante du Browser
this.URL = varString; // URL de la page de type String
this.isVirtual = Boolean();
this.Description = varString;
this.Open = function(BrowserType,isVirtual) // Instancie un fureteur selon le type
{
if (isVirtual) { // Si on utilise un Browser Virtuel
this.isVirtual = true;
var supported = VirtualBrowsers.Count;
if (BrowserType<supported) // Est-ce que celui demandé est supporté (Voir dans les Projets-Properties-Open App-Web Test-Virtual
{
var mybrowser = VirtualBrowsers.Item(BrowserType);
Log.Message(mybrowser.UserAgent);
}
this.Description = mybrowser.UserAgent;
} else {
this.isVirtual = false;
switch (BrowserType) {
case "-1" : Log["Message"]("Fureteur demandé : " + "Microsoft Internet Explorer");
var mybrowser = Browsers["Item"](btIExplorer);
break;
case "-2" : Log["Message"]("Fureteur demandé : " + "Mozilla Firefox");
var mybrowser = Browsers["Item"](btFirefox);
break;
case "-3" : Log["Message"]("Fureteur demandé : " + "Google Chrome");
var mybrowser = Browsers["Item"](btChrome);
break;
default : Log["Message"]("Fureteur demandé : " + "Microsoft Internet Explorer");
var mybrowser = Browsers["Item"](btIExplorer);
}
Log.Message("Fureteur : "+ mybrowser.Description);
Log.Message("Family " + mybrowser.Family);
this.Description = mybrowser.Description;
}
mybrowser.Run(Project["Variables"]["StartupURL"]); // La variable StartupURL se retrouve dans tous les projets.
this.Component = Sys.Browser("*",0); // Pour obtenir le processus du Browser
this.BrowserType = BrowserType;
Log["PopLogFolder"]();
return this.Component; // On retourne l'objet Browser
}
this.Navigate = function(url) // Navigue vers l'URL jusqu'à chargement complet
{
Log["AppendFolder"]("Navigation vers l'URL : "+url);
var myClock = HISUtils["StopWatch"];
myClock["Start"]();
var myPage = this.Component["ToUrl"](url);
while (myPage["contentDocument"] == null)
Delay(200);
while (myPage["contentDocument"]["readyState"] != "complete")
myPage["Wait"]();
Project["Variables"]["CurrentPage"]=myPage;
myClock["Stop"]();
//var myName = MakeLogName(Project["Variables"]["MyProject"]);
//PushToLog(myName,"Page ; " + url + " ; "+myClock["ToString"]());
Log["Message"](url + " ; "+myClock["ToString"]());
this.currentPage = myPage;
this.URL = myPage["URL"];
Log["PopLogFolder"]();
return this.currentPage; // On retourne l'objet Page de la navigation
}
this.Close = function() // Ferme le fureteur
{
this.Component["Close"]();
return null;
}
}
To instantiate the Browser
myBrowser = new Fureteur
myBrowser["Open"](-1,false) for a standard browser
myBrowser["Open"](3,true) for one of the listed Virtual Devices in Project Properties
Related Content
- 2 years ago
- 5 years ago
Recent Discussions
- 2 days ago
- 2 days ago
- 5 days ago