Validating a html web page

Before publishing your web site, you may need to validate the markup of its pages, validate CSS and check the site for broken links. Find Child("Object Identifier", "date", depth).value = modified Date; # Selects either the Full Report, or Summary Report option if (full Report): page. Find Child("id Str", "validate-by-uri", depth); # Locates the "Address" field and inputs the URL to be checked tab. Wait(); # Saves the results Save Result Page(browser Process, result File); Log. Window("#32770", "Save*"); # Saves the result save Dlg. Object Identifier == "iexplore"): while (browser Process.

Furthermore, you may need to do it every time the site contents are updated. Tree Model = "Tree"; # Creates a folder where the results will be stored results Folder = "C:\" aq Convert. Find Child("id Str", "uri", 10).value = address; # Locates the "Check" button and clicks it tab. Message("HTML results of the W3C Markup Validation Service have been saved to the following file: " \ result File); # Saves the web page to a file def Save Result Page(browser Process, result File): # Calls the Save dialog by simulating pressing the Ctrl-S shortcut browser Process.

Find Child("id Str", "validate-by-uri", depth); # Locates the "Address" field and inputs the URL to be checked tab. To Url(" # Locates the "Address" field and inputs the URL to be checked page. Using this dialog you can then command the test engine to insert the generated code into your script code, or cancel this operation.

To Url(" # Locates the "Validate by URI" tab tab = page. Click Item(medium); # Locates the "Check" button and clicks it tab. Message("CSS results of the W3C CSS Validation Service have been saved to the following file: " \ result File); # Validating HTML markup using WDG HTML Validator def Validate HTML_WDGValidator (browser Process, address, result File): page = browser Process. Tree Model = "Tree" End If ' Creates a folder where the results will be stored results Folder = "C:\" & aq Convert. Find Child("id Str", "uri", 10).value = address ' Locates the "Check" button and clicks it tab. Message("HTML results of the W3C Markup Validation Service have been saved to the following file: "_ & result File)End Sub' Saves a web page to a file Sub Save Result Page(browser Process, result File) Dim browser Window, save Dlg ' Calls the Save dialog by simulating pressing the Ctrl-S shortcut browser Process. If you inserted the checkpoint into a script, Test Complete will generate the checkpoint’ script statements and display them in special dialog box.

Find Child("id Str", "validate-by-uri", depth) ' Locates the "Address" field and inputs the URL to be checked tab. To Url(" ' Locates the "Address" field and inputs the URL to be checked page. Find Child('id Str', 'validate-by-uri', depth); // Locates the "Address" field and inputs the URL to be checked tab. Wait; // Saves the results Save Result Page(browser Process, result File); Log. Window('#32770', 'Save*'); // Saves the result save Dlg. Object Identifier = 'iexplore' then begin while (browser Process. To address the elements of the web page this test uses the Tree model, if you use other web tree models, change the operations that interact with page’s controls.

To Url(" ' Locates the "Validate by URI" tab Set tab = page. Click Item(medium) End If ' Locates the "Check" button and clicks it tab. Message("CSS results of the W3C CSS Validation Service have been saved to the following file: " _ & result File)End Sub' Validating HTML markup using WDG HTML Validator Sub Validate HTML_WDGValidator (browser Process, address, result File) Dim page Set page = browser Process. Tree Model := 'Tree'; end; // Creates a folder where the results will be stored results Folder := 'C:\' aq Convert. To Url(' // Locates the "Validate by URI" tab tab := page. Exists) do Delay(500); end;end; // Specifies the level of child objects where the desired objects will be searched forvar depth = 10;function Main() // Checks for broken links using Link Valet function Validate HTML_Link Valet (browser Process, address, modified Date, full Report, // True means Full Report, False means Summary Report recursion Depth, // 0, 1 or 2 result File) // Validating CSS using W3C CSS Validation Servicefunction Validate CSS_W3C_CSS (browser Process, address, result File, profile, medium, warning) // Validating HTML markup using WDG HTML Validatorfunction Validate HTML_WDGValidator (browser Process, address, result File) // Validating HTML markup using W3C Markup Validation Servicefunction Validate HTML_W3CMark Up Validator(browser Process, address, result File) // Saves the web page to a filefunction Save Result Page(browser Process, result File) subprocedure to save them and close the browser afterwards.

A disadvantage of this approach is that users don't know that they've made an error until after they submit the page.

All of these tools are similar: You can easily check your web site for errors using the above-mentioned tools once or twice, but if you need to check your site regularly, it is better to automate this process.

With Test Complete, you can create a script routine or a keyword test for checking and validating a web site and run it upon every change made to the site.

Click End Select ' Locates the "OK" button and clicks it page. Message("Link results of the Link Valet have been saved to the following file: "_ & result File)End Sub' Validating CSS using W3C CSS Validation Service Sub Validate CSS_W3C_CSS (browser Process, address, result File, profile, medium, warning) Dim page, tab, extra Options Set page = browser Process. Wait ' Saves the results Call Save Result Page(browser Process, result File) Log. Find Child('Object Identifier', 'date', depth).value := modified Date; // Selects either the Full Report, or Summary Report option if full Report then page. Find Child('Object Identifier', 'Validate*', depth). Message('HTML results of the WDG HTML Validator have been saved to the following file: ' result File);end;// Validating HTML markup using W3C Markup Validation Serviceprocedure Validate HTML_W3CMark Up Validator(browser Process, address, result File);var page, tab;begin page := browser Process.

Wait ' Saves the result Call Save Result Page(browser Process, result File) Log. Find Child('Object Identifier', 'url', depth).value := address; // Locates the "Highlight links modified since" field and sets the date page. Exists then begin // Expands the "More Options" panel extra Options. Click; // Locates the "Profile", "Medium" and "Warnings" combo boxes extra Options. Find Child('Object Identifier', 'url', depth).value := address; // Locates the "Validate it" button and clicks it page. Wait; // Saves the results Save Result Page(browser Process, result File); Log.

Leave a Reply