Sign in to follow this  
Followers 0
diikee

browser testing

14 posts in this topic

Well, my script tests one server browser at a time. Is it possible to create and navigate to different server browsers at the same time??

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Show us the code you are now using and.... maybe we can advise how to move forward with it!

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#include <IE.au3>

#include <File.au3>

#include <Process.au3>

Opt("WinTextmatchMode", 1)

Opt("WinTitleMatchMode",2)

;#cs

Global $Paused

HotKeySet("{PAUSE}", "TogglePause")

$ip = InputBox("Get Ip Address", "Enter IP Address: ")

$oIE = _IECreate($ip)

_IENavigate($oIE, $ip)

_IELoadWait($oIE)

$file = FileOpen("test1.txt", 9)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

FileWrite($file, "SQA Testing Started at: " & @MDAY & @MON & @YEAR & @HOUR & @MIN & @CRLF)

Func TogglePause()

$Paused = NOT $Paused

While $Paused

sleep(10000)

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

FileWrite($file, "SQA Testing Finished at: " & @MDAY & @MON & @YEAR & @HOUR & @MIN & @CRLF)

FileClose($file)

Edited by diikee

Share this post


Link to post
Share on other sites

Just one idea...

#include <IE.au3>
#include <File.au3>
#include <Process.au3>

Opt("WinTextmatchMode", 1)
Opt("WinTitleMatchMode", 2)


Global $Paused
HotKeySet("{PAUSE}", "TogglePause")

$ip = InputBox("Get Ip Address", "Enter 1 or more IP Address separated by a comma: ")
If $ip = "" Then Exit

$file = FileOpen("test1.txt", 9)

If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWrite($file, "SQA Testing Started at: " & @MDAY & @MON & @YEAR & @HOUR & @MIN & @CRLF)

$ip = StringSplit($ip, ",")

For $x = 1 To $ip[0]
    $oIE = _IECreate($ip[$x])

    FileWrite($file, "SQA Testing IP#: " & $ip[$x] & @CRLF)
    ToolTip('Testing ' & $ip[$x], 0, 0)

    $oIE = ""
Next

ToolTip("")
FileWrite($file, "SQA Testing Finished at: " & @MDAY & @MON & @YEAR & @HOUR & @MIN & @CRLF)
FileClose($file)


; - Functions -------

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(10000)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#include <IE.au3>
#include <File.au3>
#include <Process.au3>

Opt("WinTextmatchMode", 1)
Opt("WinTitleMatchMode", 2)


Global $Paused
HotKeySet("{PAUSE}", "TogglePause")

$ip = InputBox("Get Ip Address", "Enter 1 or more IP Address separated by a comma: ")
If $ip = "" Then Exit

$file = FileOpen("test1.txt", 9)

If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWrite($file, "SQA Testing Started at: " & @MDAY & @MON & @YEAR & @HOUR & @MIN & @CRLF)

$ip = StringSplit($ip, ",")

For $x = 1 To $ip[0]
    $oIE = _IECreate($ip[$x])

    FileWrite($file, "SQA Testing IP#: " & $ip[$x] & @CRLF)
    ToolTip('Testing ' & $ip[$x], 0, 0)

    $oIE = ""
Next

For $i = 1 to 3 Step 1  
    live()
    
Next

Func live()
Sleep(2000)
_IELinkClickByText($oIE, "live")
Sleep(2000)
$zs = _IETagnameGetCollection($oIE, "a")
For $z in $zs
    If String($z.className) = "zoomin" Then
        _IEAction($z, "focus")
        Sleep(500)
                                
        $iScreenX = _IEPropertyGet($z, "screenx")
        $iScreenY = _IEPropertyGet($z, "screeny")
        $iWidth = _IEPropertyGet($z, "width")
        $iHeight = _IEPropertyGet($z, "height")
        
        MouseMove($iScreenX + $iWidth/2, $iScreenY + $iHeight/2)
    
        MouseClick("left")
        Sleep(500)
    ;MouseClick("left")
        MouseDown("left")
        MouseUp("left")
        ConsoleWrite("Completed: zoomin successfully" & @LF)
        ExitLoop
    ;EndIf
    EndIf
Next

Sleep(5000)
EndFunc

ToolTip("")
FileWrite($file, "SQA Testing Finished at: " & @MDAY & @MON & @YEAR & @HOUR & @MIN & @CRLF)
FileClose($file)


; - Functions -------

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(10000)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc  ;==>TogglePause

It opens 2 browsers with same elements but gets this error:

C:\autoit\mbrowser.au3 (45) : ==> Variable must be of type "Object".:

For $z in $zs

For $z in $zs^ ERROR

Share this post


Link to post
Share on other sites

Anyone been able to test numerous browsers using the same script??

or Can I schedule it where I run it for few hours and then test another server browser??

Share this post


Link to post
Share on other sites

You can open and multiple browsers simply by using unique object variables:

$oIE1 = _IECreate(url1)

$oIE2 = _IECreate(url2)

$oIE3 = _IECreate(url3)

$oIE4 = _IECreate(url4)

You now have 4 browsers and you can can control eash independantly simply by specifying the appropriate $oIEx object in your _IE* function calls.

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

Share this post


Link to post
Share on other sites

That means I have to change my entire script to include the other 3 reference objects.

is the mouse shared across all the browsers, or how do I click buttons without actually hogging the actual mouse??

Can we virtually click the buttons without having the mouse move to the button??

Share this post


Link to post
Share on other sites

Try it. Create a test. It's easy.

The _IE* functions do not move the mouse pointer.

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

Share this post


Link to post
Share on other sites

Dale,

trying to make sure no one gets confused on the motive,

$te = _IETagNameGetCollection($oIE, "A") --->>> this would access a tag inside $oIE

I want to input 3 comma separated ip address, which would navigate to all the 3 browsers at the same time and get tested by one script.

With your explanation above I need $oIE, $oIE1, $oIE2 ---->>>to access all the browsers

$te = _IETagNameGetCollection($oIE, "A")

$te = _IETagNameGetCollection($oIE1, "A")

$te = _IETagNameGetCollection($oIE2, "A")

is there an easier way other than trippling my code size??

Can I run the test for so many hours and then navigate to another server browser and continue testing??

Share this post


Link to post
Share on other sites

Sure, use an array and a loop

Local $aIE[4]
$aIE[0] = _IECreate(url0)
$aIE[1] = _IECreate(url1)
$aIE[2] = _IECreate(url2)
$aIE[3] = _IECreate(url3)

For $i = 0 to Ubound($aIE) - 1
    $oIE = $aIE[$i]
    ; do your stuff here...
Next

BTW, _IETagNameGetCollection returns a collection of links rather than just 1 unless you use the index parameter.

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

Share this post


Link to post
Share on other sites

Seems like I've got it going with all your help.

I want to open all the browsers but instead of waiting for each to finish before testing the next one, I would like to click on buttons on one browser, put it to the back bring the other browser on top click on the same buttons like on the first browser, then put it to the back and work on another browser.

All browsers have same buttons. But each UAT has different options

how can this be accomplished??

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

The IE functions doe not care about stacking order. They do not rely on the window having focus. In fact they can be in the tray or even invisible. What the heck are you really trying to do?

Dale

Edited by DaleHohm

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

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

-Each unit comes with a browser for configuration.

-to test each unit, I have to navigate to each unit ip, and some of the buttons on the browser don't have window (handle, class, text, classnn) so the only way I can access them is to focus and move the mouse to that particular button.

So, I figured I can open all the browsers and click on the buttons on one browser, second browser, third browser -----take turns but at the same time test all the units.

Right now I can test one at a time using the comma seperated ips method.

How do I open all of the browsers, click buttons on one browser, bring the second one to the front, click buttons on it. Basically click on 6 seperate browsers, one at a time???

this tests one unit at a time:

$ip = InputBox("Get Ip Address", "Enter 1 or more IP Address separated by a comma: ")
If $ip = "" Then Exit

$ip = StringSplit($ip, ",")
For $i = 1 to 2 Step 1
    For $x = 1 To $ip[0]
        $oIE = _IECreate($ip[$x])

               WinClose($oIE)
        Sleep(2000)
        $oIE = ""
    Next
Next

when I enter the comma separated ips, can I open all the browsers to the ips instead of waiting for one to finish and the iterate to the next one??

Edited by diikee

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