Jump to content
Sign in to follow this  
veerendra

Generate Test Log in Excel or Text File

Recommended Posts

veerendra

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

Share this post


Link to post
Share on other sites
orbs

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.

Share this post


Link to post
Share on other sites
veerendra

i want to send the result (pass or fail) to excel sheet in to a particular sheet and column.

here in my code

_winwaitactivate=google then result will be pass and i want "PASS" in to excelsheet in a particular sheet3 and column

Share this post


Link to post
Share on other sites
orbs

look the Excel UDF.

you can also write the data in CSV text file.

Share this post


Link to post
Share on other sites
veerendra

i tried but i couldn't get the idea, how to use

Share this post


Link to post
Share on other sites
orbs

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

Share this post


Link to post
Share on other sites
water

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


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
veerendra

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.

Share this post


Link to post
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
Sign in to follow this  

×