[Webtest] Re: Wrong document title found!

Marc Guillemot webtest@lists.canoo.com
Mon, 17 May 2004 22:00:48 +0200


Hi,

in such a case, it is important to look at the parsing warnings and errors. In the case of IBM's start page, it's not 
really clean and that is the cause of your problem.

http://www.ibm.com/us/

Html parsing: 0 errors and 45 warnings:
[30, 1] Warning: inserting missing 'title' element
[30, 11] Warning: missing </noscript> before link
[30, 11] Warning: link isn't allowed in <noscript> elements
[30, 92] Warning: trimming empty <noscript>
[32, 1] Warning: <title> isn't allowed in <body> elements
[50, 1] Warning: </head> isn't allowed in <body> elements
[51, 1] Warning: <body> isn't allowed in <body> elements
[52, 1] Warning: <table> lacks "summary" attribute
[56, 57] Warning: <table> lacks "summary" attribute
[57, 1] Warning: <form> isn't allowed in <table> elements
[57, 75] Warning: input isn't allowed in <table> elements
[57, 117] Warning: input isn't allowed in <table> elements
[57, 162] Warning: input isn't allowed in <table> elements
[65, 1] Warning: discarding unexpected </form>
[74, 1] Warning: <table> lacks "summary" attribute
[77, 1] Warning: <table> lacks "summary" attribute
[79, 1] Warning: <table> lacks "summary" attribute
[82, 1] Warning: <table> lacks "summary" attribute
[83, 295] Warning: <table> lacks "summary" attribute
[83, 357] Warning: <form> isn't allowed in <table> elements
[93, 6] Warning: discarding unexpected </form>
[98, 27] Warning: <table> lacks "summary" attribute
[101, 1] Warning: <table> lacks "summary" attribute
[116, 14] Warning: <table> lacks "summary" attribute
[116, 180] Warning: <table> lacks "summary" attribute
[124, 78] Warning: <table> lacks "summary" attribute
[128, 14] Warning: <table> lacks "summary" attribute
[129, 645] Warning: <table> lacks "summary" attribute
[133, 1] Warning: <table> lacks "summary" attribute
[137, 22] Warning: <table> lacks "summary" attribute
[137, 88] Warning: missing <td>
[137, 231] Warning: missing </form> before <td>
[137, 231] Warning: inserting implicit <table>
[137, 231] Warning: missing <tr>
[137, 2550] Warning: discarding unexpected </form>
[137, 2576] Warning: missing </form> before </td>
[141, 130] Warning: <table> lacks "summary" attribute
[144, 1] Warning: <table> lacks "summary" attribute
[169, 1] Warning: <table> lacks "summary" attribute
[172, 1] Warning: <table> lacks "summary" attribute
[195, 1] Warning: <table> lacks "summary" attribute
[199, 1] Warning: <table> lacks "summary" attribute
[203, 1] Warning: <table> lacks "summary" attribute
[224, 1] Warning: <table> lacks "summary" attribute
[247, 1] Warning: missing </table>

Marc.

CF Wong wrote:
> Hi, I have constructed a simple script to visit a webpage. The command 
> prompt window indicates that the page retrieved has different title as 
> expected. However, when I examined the generated file, the <title> did 
> contain the text as expected. Could this be the parser problem?
>  
> I got the same problem when I visited www.bea.com <http://www.bea.com>. 
> But, it works fine for www.yahoo.ca <http://www.yahoo.ca>. I would 
> appreciate an explanation of this behaviour. Thanks.
>  
> Best Regards,
> CF
>  
> ---------- sample script -----------
> <!--=========== Starting ===========-->
> <project name="testYcebt.xml" basedir="." default="checkWebTest">
>  
> <property name="base.dir" value="${basedir}"/>
> <property name="webtest.home" value="${base.dir}/../.."/>
>  
> <taskdef file="${webtest.home}/webtestTaskdefs.properties">
>    <classpath>
>       <fileset dir="${webtest.home}" includes="**/lib/*.jar"/>
>    </classpath>
> </taskdef>
>  
> <target name="checkWebTest">
>    <echo message="base dir is ${basedir}"/>
>    <testSpec name="visting ibm website">
>       <config
>          host="www.ibm.com <http://www.ibm.com>"
>          port="80"
>          basepath="/"
>          saveresponse="true"
>          resultpath="results"
>          protocol="http" />
>       <steps>
>          <invoke
>             stepid="calling ibm.com"
>             url=""/>
>          <verifytitle
>             stepid="check the title is parsed correctly"
>             text="IBM United States" />
>       </steps>
>    </testSpec>
> </target>
> </project>
> ------------------ command prompt message ----------------
> D:\WebTest\doc\samples>ant -v -buildfile testIBM.xml
> Apache Ant version 1.5.4 compiled on August 12 2003
> Buildfile: testIBM.xml
> Detected Java version: 1.4 in: D:\Sun\AppServer\jdk\jre
> Detected OS: Windows XP
> parsing buildfile testIBM.xml with URI = 
> file:D:/WebTest/doc/samples/testIBM.xml
>  
> Project base dir set to: D:\WebTest\doc\samples
>   [taskdef] Loading definitions from file 
> D:\WebTest\webtestTaskdefs.properties
> Build sequence for target `checkWebTest' is [checkWebTest]
> Complete build sequence is [checkWebTest]
>  
> checkWebTest:
>      [echo] base dir is D:\WebTest\doc\samples
>  
> BUILD FAILED
> file:D:/WebTest/doc/samples/testIBM.xml:15: The <config> task doesn't 
> support th
> e "responsepath" attribute.
>         at 
> org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHe
> lper.java:422)
>         at 
> org.apache.tools.ant.ProjectHelper.configure(ProjectHelper.java:306)
>         at 
> org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfig
> urable.java:242)
>         at 
> org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfig
> urable.java:211)
>         at org.apache.tools.ant.Task.maybeConfigure(Task.java:259)
>         at 
> org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfig
> urable.java:260)
>         at 
> org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfig
> urable.java:211)
>         at org.apache.tools.ant.Task.maybeConfigure(Task.java:259)
>         at org.apache.tools.ant.Task.perform(Task.java:340)
>         at org.apache.tools.ant.Target.execute(Target.java:309)
>         at org.apache.tools.ant.Target.performTasks(Target.java:336)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
>         at org.apache.tools.ant.Main.runBuild(Main.java:609)
>         at org.apache.tools.ant.Main.start(Main.java:196)
>         at org.apache.tools.ant.Main.main(Main.java:235)
>  
> Total time: 1 second
> D:\WebTest\doc\samples>ant -v -buildfile testIBM.xml
> Apache Ant version 1.5.4 compiled on August 12 2003
> Buildfile: testIBM.xml
> Detected Java version: 1.4 in: D:\Sun\AppServer\jdk\jre
> Detected OS: Windows XP
> parsing buildfile testIBM.xml with URI = 
> file:D:/WebTest/doc/samples/testIBM.xml
>  
> Project base dir set to: D:\WebTest\doc\samples
>   [taskdef] Loading definitions from file 
> D:\WebTest\webtestTaskdefs.properties
> Build sequence for target `checkWebTest' is [checkWebTest]
> Complete build sequence is [checkWebTest]
>  
> checkWebTest:
>      [echo] base dir is D:\WebTest\doc\samples
>  
> BUILD FAILED
> Test step verifytitle named "check the title is parsed correctly" failed 
> with me
> ssage "Wrong document title found! Expected "IBM United States" but got """
>         at 
> com.canoo.webtest.ant.TestSpecificationTask.stopBuildIfNeeded(TestSpe
> cificationTask.java:78)
>         at 
> com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecification
> Task.java:72)
>         at org.apache.tools.ant.Task.perform(Task.java:341)
>         at org.apache.tools.ant.Target.execute(Target.java:309)
>         at org.apache.tools.ant.Target.performTasks(Target.java:336)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
>         at org.apache.tools.ant.Main.runBuild(Main.java:609)
>         at org.apache.tools.ant.Main.start(Main.java:196)
>         at org.apache.tools.ant.Main.main(Main.java:235)
>  
> Total time: 4 seconds
>  
> ------------- generated response file -------------
>  <!DOCTYPE html SYSTEM 
> "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd">
> <html lang="en-US">
> <head>
> 
> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
> <meta http-equiv="Pragma" content="no-cache"/>
> <meta http-equiv="PICS-Label" content='(PICS-1.1 
> "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 
> vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 
> 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
> <link rel="schema.DC" href="http://purl.org/DC/elements/1.0/"/>
> <link rel="SHORTCUT ICON" href="http://www.ibm.com/favicon.ico"/>
> <meta name="Security" content="public"/>
> <meta name="Source" content="Franklin/IPC"/>
> <meta name="DC.Rights" content="Copyright (c) 2002,2004 by IBM 
> Corporation"/>
> <meta name="Robots" content="index,follow"/>
> <meta name="DC.Language" scheme="rfc1766" content="en-US"/>
> <meta name="DC.Date" scheme="iso8601" content="2004-03-16"/>
> <meta name="IBM.Country" content="US"/>
> <meta name="Description" content="The IBM corporate home page, entry 
> point to information about IBM products and services"/>
> 
> <meta name="Abstract" content="The IBM corporate home page, entry point to information about IBM products and services"/>
> <meta name="Owner" content="Mary Bouton/White Plains/IBM"/>
> <meta name="Keywords" content="ibm, international business machines, internet, e-business, ebusiness, e-business on demand, ebusiness on demand, on demand, ibm on demand, on demand business, on demand enterprise, on demand services, ondemand, on-demand, personal computer, personal system, e-commerce, ecommerce, pc, workstation, mainframe, unix, linux, technical support, homepage, home page"/>
> <meta name="DC.Publisher" content="IBM Corporation"/>
> <meta name="IBM.Effective" scheme="W3CDTF" content="2002-12-17"/>
> <meta name="DC.Type" scheme="IBM_ContentClassTaxonomy" content="HP"/>
> <meta name="IBM.Industry" scheme="IBM_IndustryTaxonomy" content="ZZ"/>
> <meta name="DC.Subject" scheme="IBM_SubjectTaxonomy" content="ZZ999"/>
> 
> 
> <script src="//www.ibm.com/data/js/v13/ibmcss.js" language="JavaScript" type="text/javascript">
> </script>
> <noscript><link type="text/css" href="//www.ibm.com/data/css/v13/r1.css" rel="stylesheet"/></noscript>
> 
> <title>IBM United States</title>  <=============== ********** CORRECT ****************
> 
> <script language="JavaScript1.2" type="text/javascript">
> <!--
> // Survey trigger. Contact Kohichi Miyagawa/Japan/IBM for comments regarding the survey only. 
> var language="en"; 
> var country="us";
> var site="cvm";
> 
> ...................