Jump to content

Recommended Posts

Posted

Hello :) ,

I a trying to learn WebDriver UDF

 

i follow steps on this thread

 

But i cant figure out where to get

webdriver.au3

even on all link.

someone can help me please :) ?

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted
#include "webdriver.au3"

Local Enum $eFireFox = 0, _
            $eChrome

Local $aTestSuite[5][2] = [["TestTimeouts", True], ["TestNavigation", True], ["TestElements", True], ["TestScript", True], ["TestCookies", True]]

Local Const $_TestType = $eChrome
Local $sDesiredCapabilities
Local $iIndex

$_WD_DEBUG = True

Switch $_TestType
    Case $eFireFox
        SetupGecko()

    Case $eChrome
        SetupChrome()

EndSwitch

_WDStartup()

$sSession = _WDCreateSession($sDesiredCapabilities)
$sStatus = _WDStatus()

For $iIndex = 0 To UBound($aTestSuite, $UBOUND_ROWS) - 1
    If $aTestSuite[$iIndex][1] Then
        ConsoleWrite("Running: " & $aTestSuite[$iIndex][0] & @CRLF)
        Call($aTestSuite[$iIndex][0])
    Else
        ConsoleWrite("Bypass: " & $aTestSuite[$iIndex][0] & @CRLF)
    EndIf
Next

_WDDeleteSession($sSession)
_WDShutdown()



Func TestTimeouts()
    _WDTimeouts($sSession)
    _WDTimeouts($sSession, '{"script":10000,"pageLoad":200000,"implicit":30}')
    _WDTimeouts($sSession)
EndFunc

Func TestNavigation()
    _WDNavigate($sSession, "http://google.com")
    ConsoleWrite("URL=" & _WDAction($sSession, 'url') & @CRLF)
    _WDAction($sSession, "back")
    ConsoleWrite("URL=" & _WDAction($sSession, 'url') & @CRLF)
    _WDAction($sSession, "forward")
    ConsoleWrite("URL=" & _WDAction($sSession, 'url') & @CRLF)
    ConsoleWrite("Title=" & _WDAction($sSession, 'title') & @CRLF)
EndFunc

;_WDWindow($sSession, 'frame', '{"id":null}')

Func TestElements()
    _WDNavigate($sSession, "http://google.com")
    $sElement = _WDFindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='lst-ib1']")

    If @error = $_WD_ERROR_NoMatch Then
        $sElement = _WDFindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='lst-ib']")
    EndIf

    $sElement2 = _WDFindElement($sSession, $_WD_LOCATOR_ByXPath, "//div/input", '', True)

    _WDElementAction($sSession, $sElement, 'value', "testing 123")
    _WDElementAction($sSession, $sElement, 'text')
    _WDElementAction($sSession, $sElement, 'clear')
    _WDElementAction($sSession, $sElement, 'value', "abc xyz")
    _WDElementAction($sSession, $sElement, 'text')
    _WDElementAction($sSession, $sElement, 'clear')
    _WDElementAction($sSession, $sElement, 'value', "fujimo")
    _WDElementAction($sSession, $sElement, 'text')
    _WDElementAction($sSession, $sElement, 'click')

    _WDElementAction($sSession, $sElement, 'Attribute', 'test')

    $sElement = _WDFindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='lst-ib']")
    $sValue = _WDElementAction($sSession, $sElement, 'property', 'value')

    ConsoleWrite('value = ' & $sValue & @CRLF)
EndFunc

Func TestScript()
    _WDExecuteScript($sSession, 'alert()', "")
    _WDAlert($sSession, 'Dismiss')
EndFunc

Func TestCookies()
    _WDNavigate($sSession, "http://google.com")
    _WDCookies($sSession, 'Get', 'NID')
EndFunc


Func SetupGecko()
_WDOption('Driver', 'geckodriver.exe')
_WDOption('DriverParams', '--log trace')
_WDOption('Port', 4444)

$sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
EndFunc

Func SetupChrome()
_WDOption('Driver', 'chromedriver.exe')
_WDOption('Port', 9515)
_WDOption('DriverParams', '--log-path=' & @ScriptDir & '\chrome.log')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true }}}}'
EndFunc

 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted (edited)

Nevermind i understood my error. Now i have webdriver issue. thx

_WDStartup: OS: WIN_10 WIN32_NT 17134 
_WDStartup: AutoIt: 3.3.14.2
_WDStartup: WD.au3: 0.1.0.15
_WDStartup: Driver: geckodriver.exe
_WDStartup: Params: --log trace
_WDStartup: Port:   4444
_WD_Startup ==> General Error: Error launching web driver!
__WD_Post: URL=HTTP://127.0.0.1:4444/session; $sData={"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_CreateSession: 0
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0
Bypass: DemoTimeouts
Bypass: DemoNavigation
Bypass: DemoElements
Bypass: DemoScript
Bypass: DemoCookies
Bypass: DemoAlerts
Bypass: DemoFrames
Running: DemoActions
__WD_Post: URL=HTTP://127.0.0.1:4444/session//url; $sData={"url":"http://google.com"}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_Navigate: 0
_WD_Navigate ==> Webdriver Exception: HTTP status = 0
__WD_Post: URL=HTTP://127.0.0.1:4444/session//element; $sData={"using":"xpath","value":"//input[@id="lst-ib"]"}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_FindElement: 0
_WD_FindElement ==> Send / Recv error: HTTP status = 0
$sElement = 
$sAction = {"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"","element-6066-11e4-a52e-4f735466cecf":""}},{"button":2,"type":"pointerDown"},{"button":2,"type":"pointerUp"}]}]}
__WD_Post: URL=HTTP://127.0.0.1:4444/session//actions; $sData={"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"","element-6066-11e4-a52e-4f735466cecf":""}},{"button":2,"type":"pointerDown"},{"button":2,"type":"pointerUp"}]}]}
__WD_Post: StatusCode=0; ResponseText=0
__WD_Post ==> Send / Recv error
_WD_Action: 0
_WD_Action ==> Webdriver Exception: HTTP status = 0
__WD_Delete: URL=HTTP://127.0.0.1:4444/session//actions
__WD_Delete: StatusCode=0; ResponseText=0
__WD_Delete ==> Webdriver Exception
_WD_Action: 0
_WD_Action ==> Webdriver Exception: HTTP status = 0
__WD_Delete: URL=HTTP://127.0.0.1:4444/session/
__WD_Delete: StatusCode=0; ResponseText=0
__WD_Delete ==> Webdriver Exception
_WD_DeleteSession: 0
_WD_DeleteSession ==> Webdriver Exception: HTTP status = 0
>Exit code: 0    Time: 16.48

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted (edited)

@FrancescoDiMuro

Hey i understood all the WebDriver UDF and requirement and also about testing browsers.

nvm

i got it

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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
×
×
  • Create New...