Jump to content

Generate Test Log in Excel or Text File


Recommended Posts

Hi

i am facing this problem (because i don't know much about autoit). i want generate test log when opening a webbrowser and url blocked or not, url allowed or not. Please give me code webbrowser started if yes means store it as Pass, else Fail. like that i need for url's also. Please show me the way

Global $first
$first=_WinWaitActivate("Web Page Blocked!","")

Opt("MouseCoordMode",0)
#region ---Au3Recorder generated code Start (v3.3.7.0)  ---

#region --- Internal functions Au3Recorder Start ---
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

Run('"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"')
sleep(1000)
_WinWaitActivate("Google - Mozilla Firefox","")
sleep(1000)
MouseClick("left",269,90,1)
sleep(1000)
Send("{BACKSPACE}www.yahoo.com{DEL}{ENTER}")
sleep(1000)
_WinWaitActivate("Web Page Blocked! - Mozilla Firefox","")
Sleep(1000)
$first=_WinWaitActivate("Web Page Blocked! - Mozilla Firefox","")
If $first=_WinWaitActivate("Web Page Blocked! - Mozilla Firefox","") Then
MouseClick("left",273,62,1)
sleep(1000)
_WinWaitActivate("New Tab - Mozilla Firefox","")
sleep(1000)
MouseClick("left",306,92,1)
sleep(1000)
Send("www.google.ca{ENTER}")
sleep(1000)
MouseClick("left",1256,15,1)
Sleep(1000)
_WinWaitActivate("Confirm close","")
Sleep(1000)
MouseClick("left",178,115,1)
Else
    MsgBox(0,"Error", "Check the Settings in FortiClient")
    Exit;
EndIf

#endregion --- Au3Recorder generated code End ---
Link to comment
Share on other sites

how about this method - it can be hidden from user, so can also be launched remotely on a pc you want to test, and is more robust because it does not rely on opening windows or simulating clicks.

use the IE UDF:

_IECreate to open a connection to a website, window is hidden from user.

_IEBodyReadText go get some text from the window

check the text to see if it contains a typical blocking message by your blocking device.

don't forget to _IEQUIT at the end.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

look the Excel UDF.

you can also write the data in CSV text file.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

start with a simple example from the help for _ExcelWriteCell(), post your script here and describe the failure, so we can direct you further.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Please post the code you use so we can see what doesn't work.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Send("{BACKSPACE}www.gmail.com{DEL}{ENTER}")
sleep(1000)
_WinWaitActivate("Web Page Blocked! - Mozilla Firefox","")
Sleep(1000)

Hi, i need to open a url in mozillafirefox, i want to capture the title of the tab.  but i did miskate , the code i attached is recorded one so it not correct for me.

please give me line of code to capture title of the tab what it is and i want to pass that value to variable.

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...