Jump to content

Update html on every execution .....


Recommended Posts

Hi,

Here i m automate the testing i have the variables S.no,testcaseid,Executiondate,Result every i want to print this in to table (HTML Format)Eg:

maintain the testcase result in html format

S.No TestcaseID Executiondate Result

1 Gui001 8/8/11 Pass

Again if execute the program it needs to update the html document like this

S.No TestcaseID Executiondate Result

1 Gui001 8/8/11 Pass

2 Gui002 9/8/11 Fail

and keep on updating the document .......

Help me on this .....

Link to comment
Share on other sites

See _IEDocInsertHTML()

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Ok, fine "have it your way" ;) Guesswork: Try using 2 as the second parameter for FileOpen, this erases the previous contents of the file before writing.

PS: this post is in no way affiliated with BURGER KING ;) and the use of "have it your way" was completely co-incidental, well except for that last time. :)

Link to comment
Share on other sites

Ok, fine "have it your way" ;) Guesswork: Try using 2 as the second parameter for FileOpen, this erases the previous contents of the file before writing.

PS: this post is in no way affiliated with BURGER KING ;) and the use of "have it your way" was completely co-incidental, well except for that last time. :)

I dont have any code ...please give some simple sample program for html ...because i m new for this

Link to comment
Share on other sites

Hmm, Ok sure, I'll whip you up an example, ;) What format is the data in? Are you getting it from a file? from an array? a database?

Also, by "update" do you mean rewrite the file? or just append new values to it? :)

Writing HTML tables is just as easy as writing plain text files, just write the data in the HTML syntax for tables :D

For more info on writing files look for FileOpen, FileWrite in the help-file.

Forget code for now, at least write a basic algorithm depicting what you want done so we can be on the same page with you, and give relevant advice/help ;)

Link to comment
Share on other sites

Hmm, Ok sure, I'll whip you up an example, ;) What format is the data in? Are you getting it from a file? from an array? a database?

Also, by "update" do you mean rewrite the file? or just append new values to it? :)

Writing HTML tables is just as easy as writing plain text files, just write the data in the HTML syntax for tables :D

For more info on writing files look for FileOpen, FileWrite in the help-file.

Forget code for now, at least write a basic algorithm depicting what you want done so we can be on the same page with you, and give relevant advice/help ;)

just like this

#include <File.au3>

if FileExists("E:\1.html") Then

_FileWriteToLine("E:\1.html",12,"<TR>",0)

_FileWriteToLine("E:\1.html",13,"<TD ALIGN=CENTER>1</TD>",0)

_FileWriteToLine("E:\1.html",14,'<TD ALIGN=CENTER>'&@MDAY & "/" & @MON & "/" & @YEAR&'_'&@HOUR & "." & @MIN & "." & @SEC&'</TD> ',0)

_FileWriteToLine("E:\1.html",15,"<TD ALIGN=CENTER>"&@OSVersion&"_"&@OSArch&"</TD> ",0)

_FileWriteToLine("E:\1.html",16,"<TD ALIGN=CENTER>your text or image</TD> ",0)

_FileWriteToLine("E:\1.html",17,"<TD ALIGN=CENTER>your text or image</TD> ",0)

_FileWriteToLine("E:\1.html",18,"</TR>",0)

$Disk = "E:\1.html"

FileOpen($Disk,1)

$last_line = FileReadLine ($Disk,-1)

MsgBox(4096,"",$last_line)

Else

$Disk = "E:\1.html"

FileOpen($Disk,1)

_FileWriteToLine($Disk,1,'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ')

_FileWriteToLine($Disk,2,'<html xmlns="http://www.w3.org/1999/xhtml"> ')

_FileWriteToLine($Disk,3,'<body>')

_FileWriteToLine($Disk,4,'<TABLE BORDER=3 ALIGN=CENTER> ')

_FileWriteToLine($Disk,5,'<TR>')

_FileWriteToLine($Disk,6,'<TH WIDTH="75" HEIGHT="30">S.No</TH> ')

_FileWriteToLine($Disk,7,'<TH WIDTH="200" HEIGHT="30">Date</TH> ')

_FileWriteToLine($Disk,8,'<TH WIDTH="150" HEIGHT="30">OsType</TH> ')

_FileWriteToLine($Disk,9,'<TH WIDTH="750" HEIGHT="30">Testcase</TH> ')

_FileWriteToLine($Disk,10,'<TH>Status</TH>')

_FileWriteToLine($Disk,11,'</TR>')

_FileWriteToLine($Disk,12,'</TABLE>')

_FileWriteToLine($Disk,13,'</body> ')

_FileWriteToLine($Disk,14,'</html> ')

EndIf

Link to comment
Share on other sites

Quite a nice chunk of code you got there ;) Do you still need help? If so, what do you want to add? It ran fine with me :)

PS: Using codetags when posting makes your code easier to read ;)

K Smartee every time i need to change S.no it is possible in my code ......

Link to comment
Share on other sites

Sure, change the first bit of your code to something like this; the Ini file stores the count :)

If FileExists("E:\1.html") Then
    $ini = @ScriptDir & "\MyAutoItSettings.ini"
    $iCount = IniRead($ini, "Data", "Sno", "0") + 1
    IniWrite($ini, "Data", "Sno", $iCount)
    _FileWriteToLine("E:\1.html", 12, "<TR>", 0)
    _FileWriteToLine("E:\1.html", 13, "<TD ALIGN=CENTER>" & $iCount & "</TD>", 0)
Link to comment
Share on other sites

Where am I from? how is that relevant, :) I'm trying to help you, anyway look to the left right under Gender: Not telling, it says Location: Lesser Antilles ;)

Ok, do you already have some code that automates its testing?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...