Forum Discussion
11 Replies
- tristaanogreEsteemed ContributorWhat version of FireFox are you using and what version of TestComplete? TC 8.60 supports FF through version 6...
- hanContributorFF 6.0.2
TC 8.60.665.7 - tristaanogreEsteemed ContributorThat should work generally.
What sort of errors are you getting? - hanContributor
Hi again this could be a more general issue - getting some simular problems with IE as well.
Some times the:
//IE
Page(page_URL).Application.document.Script.routine_name( [Parameter1, Parameter2, ...] )//FF
Page(page_URL).contentDocument.Script.routine_name( [Parameter1, Parameter2, ...] )
Script can't be found?!
When checking the Object Browser the is no properties for:
Page(page_URL).Application.document
Page(page_URL).contentDocument
Instead there is a Fields (tab).
Demo:
Sys.Process("iexplore").Page("http://www.microsoft.com/en-us/default.aspx") has:
Properties - Application ("Windows Internet Explorer") that has
Properties - Document ("(Object)") that has
Properties - Script ("(Object)")
Sys.Process("iexplore").Page("http://smartbear.com/") has:
Properties - Application ("Windows Internet Explorer") that has
Properties - Document ("[object Document]") that has
Fields - NO Scripts - tristaanogreEsteemed ContributorScripts can only be called from the page if the page itself contains tags as indicated in that help topic, like so:
<SCRIPT LANGUAGE="JavaScript">
function MyFunc(AString, AnInteger)
{
. . .
}
</SCRIPT>
or<SCRIPT LANGUAGE="JavaScript" src="../ScriptFolder/MyScriptFile.js">
</SCRIPT>
If the page does not contain "Script" tags like this, there will be no "Script" object on the document. - hanContributorOf course I understand there has to be a Javascript function to be able to call it from inside the TC script.
Let me do another "demo":
Create a html page like:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<SCRIPT LANGUAGE="JavaScript">
function displayDate() {
document.getElementById("demo").innerHTML = Date();
}
</script>
</head>
<body>
<p id="demo">Test Area</p>
<button type="button" onclick="displayDate()">Display Date</button>
</body>
</html>
The page works in both IE (9) and FF (6) using the html button.
But in TC I can just call the script in FF!?function Test(){
//IE
var pageIE = Sys.Process("iexplore").Page("*demo.htm");
pageIE.Application.Document.Script.displayDate();
//FF
var pageFF = Sys.Process("firefox").Page("*demo.htm");
pageFF.contentDocument.Script.displayDate();
}
Checking the object browser:
Page(page_URL).contentDocument.Script - shows for FF
Page(page_URL).Application.document.Script - Isn't showing for IE and the document has only "Fields" and no "Properties"
What makes TC not recognize the Script?
Why is TC showing fields instead of properties?
(I sometimes get the opposite behavior (IE working and FF not working) on other html pages)
Best regards Håkan - hanContributorCould it be the doctype declaration that is causing it???
Seems to be working when I remove it from the webpage (or even just the !)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - hanContributorHi again,
My thoughts now are that TestComplete can't handle html documents that are opened in Document Mode: IE9
Setting the Document mode to IE7 or IE8 makes it possible to access the javascripts. - ArtemS
Alumni
Hello Håkan
Thank you for sharing this information. We'll investigate whether the issue can be gracefully handled or, at least, update the respective help topic with your workaround. - hanContributorOK - besides that TC can't call javascript in IE an documents that are opened in Document Mode: IE9
We still having problem with calling javascripts in FF.
I think TC aren't able to take a function as a parameter.
This is crucial for us since we are using an ajax framework with callback functions.
We are getting:
Microsoft JScript runtime error
Invalid procedure call or argument
When calling a function like:
var pageFF = Sys.Process("firefox").Page("*");
Script = pageFF.contentDocument.Script
Item = Script.JSFunction("param1", function() {});
The same function call works in IE