Jump to content
Danp2

WebDriver UDF (W3C compliant version) - 7/14/2019

Recommended Posts

You only showed the output for the one command, so I have the assume that the prior one was successful. This is a standard Webdriver error, which could be the result of a few things like the link is hidden, disabled, or obscured by another element. Without an example script to run so that we can observe the error, it will be difficult to guide you on how to fix this.

One thing you could try is using Firefox instead of Chrome to rule out an issue with chromedriver.

Share this post


Link to post
Share on other sites

@Danp2 I have extracted those au3 files, core, helper, and demo. now it gives me this error: 

"C:\Users\a\Desktop\Bots\MyBotScripts\testing_WebDiver.au3"(26,12) : error: _WDStartup(): undefined function.

 

this is my code so far. I am just trying to test it to see if it works. 

;#include "webdriver.au3" Cant find this file?
#include "wd_core.au3"
#include "wd_helper.au3"
#include "wd_demo.au3"

_WDStartup()

 

Share this post


Link to post
Share on other sites

@Danp2 Ok I changed it and this is what it gave me: 

Code:

#include "wd_core.au3"
#include "wd_helper.au3"
#include "wd_demo.au3"

_WD_Startup()

Output:

_WDStartup: OS:    WIN_10 WIN32_NT 17134 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.1.0.16
_WDStartup: Driver:    geckodriver.exe
_WDStartup: Params:    --log trace
_WDStartup: Port:    4444
_WD_Startup ==> General Error: Error launching web driver!

 

Then I tried the test code you posted a year ago and this is what that gave me:

Code:

#include "wd_core.au3"
#include "wd_helper.au3"
#include "wd_demo.au3"

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

Local $sDesiredCapabilities
Local $iIndex

Global $_WD__LOCATOR_ByXPath
Global $_WD__ERROR_NoMatch

$_WD__DEBUG = True

Switch $_TestType
    Case $eFireFox
        SetupGecko()

    Case $eChrome
        SetupChrome()

EndSwitch

_WD_Startup()

$sSession = _WD_CreateSession($sDesiredCapabilities)
$sStatus = _WD_Status()

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

_WD_DeleteSession($sSession)
_WD_Shutdown()



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

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

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

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

    If @error = $_WD__ERROR_NoMatch Then
        $sElement = _WD_FindElement($sSession, $_WD__LOCATOR_ByXPath, "//input[@id='lst-ib']")
    EndIf

    $sElement2 = _WD_FindElement($sSession, $_WD__LOCATOR_ByXPath, "//div/input", '', True)

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

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

    $sElement = _WD_FindElement($sSession, $_WD__LOCATOR_ByXPath, "//input[@id='lst-ib']")
    $sValue = _WD_ElementAction($sSession, $sElement, 'property', 'value')

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

Func TestScript()
    _WD_ExecuteScript($sSession, 'alert()', "")
    _WD_Alert($sSession, 'Dismiss')
EndFunc

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

Output:

_WDStartup: OS:    WIN_10 WIN32_NT 17134 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.1.0.16
_WDStartup: Driver:    geckodriver.exe
_WDStartup: Params:    --log trace
_WDStartup: Port:    4444
_WD_Startup ==> General Error: Error launching web driver!

Share this post


Link to post
Share on other sites

I have the geckodiver.exe in the include folder. is that not where it goes? 

Also what line should I add this to?

_WD_Option('Driver', 'geckodriver.exe')

 

Share this post


Link to post
Share on other sites
Posted (edited)

@Danp2 Ok so i added the path and this is the new output:

_WDStartup: OS:    WIN_10 WIN32_NT 17134 
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.1.0.16
_WDStartup: Driver:    C:\Users\a\Desktop\General help\AutoIt_Stuff\AU3 include files\geckodriver.exe
_WDStartup: Params:    --log trace
_WDStartup: Port:    4444
__WD_Post: URL=HTTP://127.0.0.1:4444/session; $sData={"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"session not created","message":"Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line","stacktrace":""}}
_WD_CreateSession: {"value":{"error":"session not created","message":"Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line","stacktrace":""}}
_WD_CreateSession ==> Webdriver Exception: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line
__WD_Delete: URL=HTTP://127.0.0.1:4444/session/
__WD_Delete: StatusCode=404; ResponseText={"value":{"error":"unknown command","message":"DELETE /session/ did not match a known command","stacktrace":""}}
_WD_DeleteSession: {"value":{"error":"unknown command","message":"DELETE /session/ did not match a known command","stacktrace":""}}

 

Code: I ran the demo code 

#include "wd_core.au3"
#include "wd_helper.au3"

Local Enum $eFireFox = 0, _
            $eChrome, _
            $eEdge

Local $aDemoSuite[][2] = [["DemoTimeouts", False], _
                        ["DemoNavigation", False], _
                        ["DemoElements", True], _
                        ["DemoScript", False], _
                        ["DemoCookies", False], _
                        ["DemoAlerts", False], _
                        ["DemoFrames", False], _
                        ["DemoActions", False], _
                        ["DemoWindows", False]]

Local Const $_TestType = $eFireFox
Local Const $sElementSelector = "//input[@name='q']"

Local $sDesiredCapabilities
Local $iIndex
Local $sSession

$_WD_DEBUG = $_WD_DEBUG_Info

Switch $_TestType
    Case $eFireFox
        SetupGecko()

    Case $eChrome
        SetupChrome()

    Case $eEdge
        SetupEdge()

EndSwitch

_WD_Startup()

If @error <> $_WD_ERROR_Success Then
    Exit -1
EndIf

$sSession = _WD_CreateSession($sDesiredCapabilities)

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

_WD_DeleteSession($sSession)
_WD_Shutdown()


Func DemoTimeouts()
    _WD_Timeouts($sSession)
    _WD_Timeouts($sSession, '{"pageLoad":2000}')
    _WD_Timeouts($sSession)
EndFunc

Func DemoNavigation()
    _WD_Navigate($sSession, "http://google.com")
    _WD_NewTab($sSession)
    _WD_Navigate($sSession, "http://yahoo.com")
    _WD_NewTab($sSession)
    _WD_Navigate($sSession, "http://bing.com")

    ConsoleWrite("URL=" & _WD_Action($sSession, 'url') & @CRLF)
    _WD_Attach($sSession, "google.com", "URL")
    ConsoleWrite("URL=" & _WD_Action($sSession, 'url') & @CRLF)
    _WD_Attach($sSession, "yahoo.com", "URL")
    ConsoleWrite("URL=" & _WD_Action($sSession, 'url') & @CRLF)
EndFunc

Func DemoElements()
    Local $sElement, $aElements, $sValue

    _WD_Navigate($sSession, "http://google.com")
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='q1']")

    If @error = $_WD_ERROR_NoMatch Then
        $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sElementSelector)
    EndIf

    $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div/input", '', True)

    _ArrayDisplay($aElements)

    _WD_ElementAction($sSession, $sElement, 'value', "testing 123")
    Sleep(500)

    _WD_ElementAction($sSession, $sElement, 'text')
    _WD_ElementAction($sSession, $sElement, 'clear')
    Sleep(500)
    _WD_ElementAction($sSession, $sElement, 'value', "abc xyz")
    Sleep(500)
    _WD_ElementAction($sSession, $sElement, 'text')
    _WD_ElementAction($sSession, $sElement, 'clear')
    Sleep(500)
    _WD_ElementAction($sSession, $sElement, 'value', "fujimo")
    Sleep(500)
    _WD_ElementAction($sSession, $sElement, 'text')
    _WD_ElementAction($sSession, $sElement, 'click')

    $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='btnK']")
    ConsoleWrite("Button Ref: " & $sButton & @CRLF)
    ConsoleWrite("Before Click" & @CRLF)
    _WD_ElementAction($sSession, $sButton, 'click')    ;<
    Sleep(2000)
    ConsoleWrite("After Click" & @CRLF)

    _WD_ElementAction($sSession, $sElement, 'Attribute', 'text')

    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sElementSelector)
    $sValue = _WD_ElementAction($sSession, $sElement, 'property', 'value')

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

EndFunc

Func DemoScript()
    _WD_ExecuteScript($sSession, "return arguments[0].second;", '{"first": "1st", "second": "2nd", "third": "3rd"}')
    _WD_Alert($sSession, 'Dismiss')
EndFunc

Func DemoCookies()
    _WD_Navigate($sSession, "http://google.com")
    _WD_Cookies($sSession, 'Get', 'NID')

    Local $sName = "Testname"
    Local $sValue ="TestValue"
    Local $sCookie = '{"cookie": {"name":"' & $sName & '","value":"' & $sValue & '"}}'
    _WD_Cookies($sSession, 'add', $sCookie)
    _WD_Cookies($sSession, 'Get', $sName)
EndFunc

Func DemoAlerts()
    ConsoleWrite('Alert Detected => ' & _WD_Alert($sSession, 'status') & @CRLF)
    _WD_ExecuteScript($sSession, "alert('testing 123')")
    ConsoleWrite('Alert Detected => ' & _WD_Alert($sSession, 'status') & @CRLF)
    ConsoleWrite('Text Detected => ' & _WD_Alert($sSession, 'gettext') & @CRLF)
    _WD_Alert($sSession, 'sendtext', 'new text')
    ConsoleWrite('Text Detected => ' & _WD_Alert($sSession, 'gettext') & @CRLF)
    Sleep(5000)
    _WD_Alert($sSession, 'Dismiss')

EndFunc

Func DemoFrames()
    _WD_Navigate($sSession, "https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_frame_cols")
    ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe[@id='iframeResult']")
    _WD_FrameEnter($sSession, $sElement)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
    _WD_FrameLeave($sSession)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)

EndFunc

Func DemoActions()
    Local $sElement, $aElements, $sValue

    _WD_Navigate($sSession, "http://google.com")
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sElementSelector)

ConsoleWrite("$sElement = " & $sElement & @CRLF)

    $sAction = '{"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"'
    $sAction &= $sElement & '","' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}},{"button":2,"type":"pointerDown"},{"button":2,"type":"pointerUp"}]}]}'

ConsoleWrite("$sAction = " & $sAction & @CRLF)

    _WD_Action($sSession, "actions", $sAction)
    sleep(5000)
    _WD_Action($sSession, "actions")
    sleep(5000)
EndFunc

Func DemoWindows()
    Local $sResponse, $sResult, $sJSON, $sImage

    _WD_Navigate($sSession, "http://google.com")
    $sResponse = _WD_Window($sSession, 'screenshot')
    $sJSON = Json_Decode($sResponse)
    $sResult = Json_Get($sJSON, "[value]")

    $sImage = BinaryToString(base64($sResult, False))
    ConsoleWrite($sImage & @CRLF)

EndFunc

Func SetupGecko()
_WD_Option('Driver', 'C:\Users\a\Desktop\General help\AutoIt_Stuff\AU3 include files\geckodriver.exe')
_WD_Option('DriverParams', '--log trace')
_WD_Option('Port', 4444)

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

Func SetupChrome()
_WD_Option('Driver', 'C:\Users\a\Desktop\General help\AutoIt_Stuff\AU3 include files\chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')

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

Func SetupEdge()
_WD_Option('Driver', 'MicrosoftWebDriver.exe')
_WD_Option('Port', 17556)
_WD_Option('DriverParams', '--verbose')

$sDesiredCapabilities = '{"capabilities":{}}'
EndFunc

;==============================================================================================================================
; Function:         base64($vCode [, $bEncode = True [, $bUrl = False]])
;
; Description:      Decode or Encode $vData using Microsoft.XMLDOM to Base64Binary or Base64Url.
;                   IMPORTANT! Encoded base64url is without @LF after 72 lines. Some websites may require this.
;
; Parameter(s):     $vData      - string or integer | Data to encode or decode.
;                   $bEncode    - boolean           | True - encode, False - decode.
;                   $bUrl       - boolean           | True - output is will decoded or encoded using base64url shema.
;
; Return Value(s):  On Success - Returns output data
;                   On Failure - Returns 1 - Failed to create object.
;
; Author (s):       (Ghads on Wordpress.com), Ascer
;===============================================================================================================================
Func base64($vCode, $bEncode = True, $bUrl = False)

    Local $oDM = ObjCreate("Microsoft.XMLDOM")
    If Not IsObj($oDM) Then Return SetError(1, 0, 1)

    Local $oEL = $oDM.createElement("Tmp")
    $oEL.DataType = "bin.base64"

    If $bEncode then
        $oEL.NodeTypedValue = Binary($vCode)
        If Not $bUrl Then Return $oEL.Text
        Return StringReplace(StringReplace(StringReplace($oEL.Text, "+", "-"),"/", "_"), @LF, "")
    Else
        If $bUrl Then $vCode = StringReplace(StringReplace($vCode, "-", "+"), "_", "/")
        $oEL.Text = $vCode
        Return $oEL.NodeTypedValue
    EndIf

EndFunc ;==>base64

 

Edited by nooneclose

Share this post


Link to post
Share on other sites
7 minutes ago, nooneclose said:

__WD_Post: StatusCode=500; ResponseText={"value":{"error":"session not created","message":"Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line","stacktrace":""}}

It can't find FireFox. If you've installed it to a non-default location, then it is your responsibility to provide it with the correct path. I believe there is an example of this in either this thread or the one for Webdriver support.

Share this post


Link to post
Share on other sites

@Danp2 I installed the latest version of Firefox and let it install in its default location and the demo script worked perfectly. Thank you very much for all your help!   

Share this post


Link to post
Share on other sites

I want to create a session (chrome website) which playing a video.

After that i have another script  that run regularly in the background to do somethings on an existing session (such as volume adjustment..)

For some reasons i cant re-open the website every time i want to adjust the volume so that i have to separate  into 2 scripts.

My solution is to write the session id to a text file and read it every time i want to control this session.

Are there any better solutions to handle this problem?

Many thanks.

Share this post


Link to post
Share on other sites
55 minutes ago, chadkin2019 said:

My solution is to write the session id to a text file and read it every time i want to control this session.

That's one solution. Other options would be --

  • Passing the session id as a parameter to the 2nd script
  • Use IPC to pass the session id between scripts
  • Combine everything into a single script that remains running in the background

Share this post


Link to post
Share on other sites

Hi  Dan,

I asked some question for tables and you asked me for some example

1) I wanted to highlight a table and it does not seem to works properly in my examples

2)  i coded the function  _WD_GetTableContent($sSession, $aElements, $Separator)

I think you can add this fonction to your library (and if you want improve it, you ll welcome :D )


Thanks for your help and answer

Test.html

GetTable.au3

Share this post


Link to post
Share on other sites

Hi,

Can anyone help me.

 

in html page i have two html code

<button class="applyBtn btn btn-sm btn-success" disabled="disabled" type="button">Apply</button>

and other one

<button class="applyBtn btn btn-sm btn-success"  type="button">Apply</button>

 The button is control by javascript to show the disable one or not

 

How can i want the UDF click this butto when it was enable?. This is my code

$sElement222 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@class='applyBtn btn btn-sm btn-success']")
_WD_ElementAction($sSession, $sElement222, 'click')

Are this UDF can click the seconds enable button, hope anybody can help me.

 

Edited by fagh81

Share this post


Link to post
Share on other sites

Hello,

i get the following error:

 

__WD_Post: URL=HTTP://127.0.0.1:9515/session/60735297ef5fae98bfc3aa4ceeb83dce/element/2e066b85-ddef-4ace-919d-c858e50b5700/value; $sData={"id":"2e066b85-ddef-4ace-919d-c858e50b5700", "text":"temp"}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=71.0.3578.98)","stacktrace":"Backtrace:\n\tOrdinal0 [0x0107AA90+830096]\n\tOrdinal0 [0x0102581D+481309]\n\tOrdinal0 [0x00FFAC47+306247]\n\tOrdinal0 [0x00FC5DB1+89521]\n\tOrdinal0 [0x00FDAA9D+174749]\n\tOrdinal0 [0x00FC4E28+85544]\n\tOrdinal0 [0x00FDAD31+175409]\n\tOrdinal0 [0x00FE208B+204939]\n\tOrdinal0 [0x00FDA93B+174395]\n\tOrdinal0 [0x00FC2D54+77140]\n\tOrdinal0 [0x00FC430C+82700]\n\tOrdinal0 [0x00FC4260+82528]\n\tOrdinal0 [0x01085302+873218]\n\tOrdinal0 [0x01030553+525651]\n\tOrdinal0 [0x01030783+526211]\n\tOrdinal0 [0x0103086C+526444]\n\tOrdinal0 [0x010883A7+885671]\n\tOrdinal0 [0x010303BF+525247]\n\tOrdinal0 [0x0103A60E+566798]\n\tOrdinal0 [0x01045DDB+613851]\n\tOrdinal0 [0x01045F45+614213]\n\tOrdinal0 [0x01045175+610677]\n\tBaseThreadInitThunk [0x74F08484+36]\n\tRtlAreBitsSet [0x77573AB8+136]\n\tRtlAreBitsSet [0x77573A88+88]\n"}}
_WD_ElementAction: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=71.0.3578.98)...
_WD_ElementAction ==> Webdriver Exception: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=71.0.3578.98)","stacktrace":"Backtrace:\n\tOrdinal0 [0x0107AA90+830096]\n\tOrdinal0 [0x0102581D+481309]\n\tOrdinal0 [0x00FFAC47+306247]\n\tOrdinal0 [0x00FC5DB1+89521]\n\tOrdinal0 [0x00FDAA9D+174749]\n\tOrdinal0 [0x00FC4E28+85544]\n\tOrdinal0 [0x00FDAD31+175409]\n\tOrdinal0 [0x00FE208B+204939]\n\tOrdinal0 [0x00FDA93B+174395]\n\tOrdinal0 [0x00FC2D54+77140]\n\tOrdinal0 [0x00FC430C+82700]\n\tOrdinal0 [0x00FC4260+82528]\n\tOrdinal0 [0x01085302+873218]\n\tOrdinal0 [0x01030553+525651]\n\tOrdinal0 [0x01030783+526211]\n\tOrdinal0 [0x0103086C+526444]\n\tOrdinal0 [0x010883A7+885671]\n\tOrdinal0 [0x010303BF+525247]\n\tOrdinal0 [0x0103A60E+566798]\n\tOrdinal0 [0x01045DDB+613851]\n\tOrdinal0 [0x01045F45+614213]\n\tOrdinal0 [0x01045175+610677]\n\tBaseThreadInitThunk [0x74F08484+36]\n\tRtlAreBitsSet [0x77573AB8+136]\n\tRtlAreBitsSet [0x77573A88+88]\n"}}

with this code:

 

#include "wd_core.au3"
#include "wd_helper.au3"

Local $sSession, $sDesiredCapabilities
SetupChrome()

_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
StartRegistration()
_WD_Shutdown()

Func StartRegistration()
   _WD_Navigate($sSession, "https://www.dazn.com/de-DE")
   _WD_LoadWait($sSession)
   _WD_Navigate($sSession, "https://www.dazn.com/de-DE/account/signup")
   _WD_LoadWait($sSession)
   $firstName = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='firstName']")
   _WD_ElementAction($sSession, $firstName , 'value', "temp")
EndFunc

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

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

 

I just want to fill in some value into the firstname field, but i always get the error: value must be a list.

 

Can someone help me?

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

  • Similar Content

    • By Davidowicza
      Hey guys,
      I am creating my very first script that automates a browser (I usually work with program installs and database automation) and have come across an issue that I am totally stumped on. I need to click an element that gives me a drop down list box but the Xpath to the element changes with every instance of chrome I start...
      I have tried selecting the class, rect, and path but no luck. It never finds the element. (I could be doing this wrong since I am not good at HTML)
      Element I need to select:
      This is the Xpath for the last 3 instances of chrome I have run the script with:
      //*[@id="highcharts-5bp9crq-8"]/svg/g[6]/g/rect //*[@id="highcharts-fiw9szv-8"]/svg/g[6]/g/rect //*[@id="highcharts-5szkmx8-8"]/svg/g[6]/g/rect As you can see the path changes every time.
      How I am trying to select the element:
      ;Check for box element _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='highcharts-5bp9crq-8']/svg/g[6]/g") MsgBox(0, "", "check for timeout") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='highcharts-5bp9crq-8']/svg/g[6]/g") _WD_ElementAction($sSession, $sElement, 'click') Maybe someone has come across this before and found a work around without using mouseclick()
      Thanks guys, hopefully I am just very overlooking something simple and can be pointed to the right solution.
      Side Note: I wish I could share the webpage entirety, but it has sensitive information with my agency that I cannot share. If you need more, just let me know and I will try and post as much as I can.
    • By Danp2
      This is the "General Help and Support" thread for the WebDriver UDF.
      The UDF itself can be downloaded here.
      So if you have any questions, suggestions or errors please post here.
    • By daluu
      This is kind of already posted here:
      '?do=embed' frameborder='0' data-embedContent>>
      but wanted to note this in this forum of example scripts in case some people only look in this forum for examples and not the other forums with respect to AutoIt integration or relation to Selenium WebDriver.
      So, the example in summary is: you can use Selenium WebDriver API to do AutoIt GUI automation (the ControlXyz() and WinXyz() functons, along with mouse and "send keys" functions). Although I suppose that might be opposite or counter to what most examples here are about - using AutoIt to do or control other stuff rather than using other stuff to control/run AutoIt. But regardless, it is an example implementation of a different use case for AutoIt beyond the general AutoIt community, like those who also use Selenium WebDriver and/or need to integrate Selenium with AutoIt for remote deployment.
      https://github.com/daluu/AutoItDriverServer
      with specific demo examples here:
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/CalculatorTest.java
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/calculator.py
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/SeleniumIntegrationTest.java
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/SeleniumIntegrationWithAutoItDriver.py
    • By TechCoder
      Below you will find both a new Marquee UDF (many W3C/HTML5 features and more) as well as a user-friendly program that both serves as an example script, as well as it will create the code for any particular marquee for you!  Enjoy!   ~~~~~~~~~~~~~~~~~  BACKGROUND on <marquee> ~~~~~~~~~~~~~~~~~ <marquee> has been classed as "non-standard" and "non-conforming" as an HTML element   (http://www.w3.org/wiki/HTML/Elements/marquee)  There is no promise that it will continue to be supported in the future, though it is obvious that many people have a need for this feature and it has remained in the major browsers for years.....   <marquee> was originally built into Internet Explorer only, now supported in other browsers, though some original features do not work in IE either - it is clearly trying to be phased out, though a 'replacement' of sorts is coming around, using HTML5 components, so I think it will never totally go away. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   For a project I'm working on, I need a way to create a LOT of different marquees.  I thought it simpler to have a program create the code needed, and built the attached 'user interface' program using various references to the feature.   THE USER PROGRAM IS BACKWARD COMPATIBLE WITH THE EXISTING UDF FROM Melba23   I also needed some features that are not part of the UDF from Melba23 that are direct references to current (HTML5) recommendations from http://www.w3.org/TR/CSS2/, so I modified the current UDF to create the additional functions, which make the UDF more HTML5 compliant (some of the features I built in have no HTML5 component, existing functions were updated only where needed for the first release - perhaps someday the rest can be done, though no immediate plans)    *******************************************************************************************************************************    KNOWN ISSUES and/or LIMITATIONS within the user program   - Tip text NOT IMPLEMENTED (from _GUICtrlMarquee_SetDisplay $sTipTxt) - I had no use for it in my project, though it is not difficult to add if you need to   - border styles do not correspond to w3.org settings (not the program's fault...) This article (http://webdesign.about.com/od/beginningcss/a/aa091207.htm) states that IE does not support 'groove', 'ridge', 'inset' or 'outset' styles, yet does support 'dotted', 'dashed' and 'double'.   Testing has proven this is true for IE (11), however, in testing AutoIt (with the Marquee UDF), which I thought uses IE (?), it appears that just the OPPOSITE of this is true.  Another item for further testing/study.........   - 'Align' feature not working 100% on all fonts (not the program's fault! the initial version of <marquee> (designed for IE and copied to other browsers later) contained an element called 'align', which has long been obsolete in favor of css 'vertical-align', however, it is not a direct replacement  and does not work inside <marquee>.     Several alternatives were tried (including 'line-height' and even 'vspace', which may also soon be phased out) and nothing works 'perfectly' (search the web on font sizing and spacing - you will see this is extremely difficult).        This program works around these challenges in a 'best effort' way, using calculations and 'top-margin' (or vspace) spacing.        'Recommended' fonts (http://www.autoitscript.com/autoit3/docs/appendix/fonts.htm) will be set to 'center' or 'bottom' (within a pixel or 2), while other fonts may be off by several pixels (something in the font is different..).        If you need the other fonts, a bit of testing would give some offset numbers that could result in better display. (this is NOT on my list to do, though maybe someone would want to take that on???)   - You can create 'unreadable', 'unusable' and even 'UGLY' marquees (not the program's fault, either!) While a bit of effort was put into limiting things, there is no cross-checking to make sure your marquee will look 'nice'.  All parameters within the marquee feature have been tested to their max/min limits (and pushed well past the documented limits for speed and delay - you can make a  F A S T  or  S L O W  marquee well outside the published specs!) and set accordingly.   Any/all color scheme, font size, etc. can be used (no matter how horrible the outcome...) so have fun and create what you like!    *******************************************************************************************************************************   Additional recommendations from w3.org built into Marquee_W3C.au3 UDF   1. Border thickness (width) refered as "thin", "medium" and "thick" or <length> (any number - to infinity)      (http://www.w3.org/TR/CSS2/box.html#border-properties)     (http://www.w3schools.com/jsref/prop_style_borderwidth.asp) Marquee_W3C UDF allows any number as an entry, as well as the more 'friendly' named terms   2. Border Style is included in Marquee_W3C UDF (not in the current UDF, therefore, none of the settings in the user program do anything if you use the old UDF, so it is set to $GUI_DISABLE.)   3. use of PIXELS and EM for formatting text instead of POINTS      http://www.w3.org/TR/CSS2/fonts.html#font-size-props use <length> paramaters      http://www.w3.org/TR/CSS2/syndata.html#value-def-length with named length units (em, ex, cm, in, px, etc.)   POINTS are used in typsetting, while PIXELS, and EM are more correct methods of sizing fonts on modern monitors (one good article on this topic can be found at http://webdesign.about.com/cs/typemeasurements/a/aa042803a.htm )   NOTE: The user program is backward compatible with the UDF from Melba23 that uses POINTS and auto-sets the parameter with the chosen UDF.    
      Marquee_W3C.au3
      MarqueeMaker.au3
×
×
  • Create New...