Jump to content

WebDriver UDF - Help & Support (II)


Danp2
 Share

Recommended Posts

Yeah editing my post non-stop made me send you wrong things.... 

This was the....

Well ok forget it. 

I'll do a simple reproducer. I think I have something wrong. It always works and not now. I will figure out why. 

 

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

 

Link to comment
Share on other sites

27 minutes ago, caramen said:

Does that main it could be the GuiRegisterMsg that cause this behavior ?

I cannot tell for sure until we got a replicable script that involves this.  One thing is sure, you are not following the GuiRegisterMsg rule of leaving as fast as possible, creating that way a bunch of new window messages that could interfere with the current message...

Link to comment
Share on other sites

23 minutes ago, Nine said:

I cannot tell for sure until we got a replicable script that involves this.  One thing is sure, you are not following the GuiRegisterMsg rule of leaving as fast as possible, creating that way a bunch of new window messages that could interfere with the current message...

I'm not sure to understand. 

Could you please wait my reproducer and then learn me what I do wrong if you see something going that way ? 

I'll make reproducer @ home. 1~2 hours.

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

 

Link to comment
Share on other sites

I will post the reproducer, so you could learn me what I do wrong if I do something wrong.... 

 Have still an issue in this reproducer... BUT... WebDriver not crashing anymore... So that mean I have 2 issue. One about the URLs. One about WebDriver. 

The WebDriver issue seem like to be resolved using the reproducer. But still weblink are not opened in the browser in new tabs. If you could watch about that. I will investigate to locate where is the thing that make WD crash. 

Edit : NVM wd is crashing again... in reproducer I don't know why it's never same behavior even at start. 

_WD_ExecuteScript: {"value":{"error":"unknown error","message":"unknown error: session deleted because of page crash\nf...

 

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

 

Link to comment
Share on other sites

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here


#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>
#include <StringConstants.au3>
#include <TrayConstants.au3>
#include <Array.au3>
#include <ColorConstants.au3>
#include <File.au3>
#include <GuiRichEdit.au3>
#include <GUIConstants.au3>
#include <GuiListView.au3>

;~ WebDrivers >
#include <WD_core.au3>
#include <WD_helper.au3>
#include <WinHTTP.au3>
#include <Json.au3>


HotKeySet("{F4}", "_Exit")
Global $sMsg , $sdk , $ConsoleTexte , $test1 , $test2 , $test3 , $WMNotifyTest = 0 , $sDesiredCapabilities , $sSession

            Global $GUI3 = GUICreate ( "Masque symptome" , 1100 ,500 , -1, -1, False )
            ;===========================================================================
            Global $Color_1 = 0xb2b4dc
            Global $Color_2 = 0xb1b8be
            Global $hSymptLabel01 = GUICtrlCreateLabel ( "OS du poste : " , 50 , 100 )
            Global $hRadio01 = GUICtrlCreateRadio ( "W7"  , 150 , 95 )
            Global $hRadio02 = GUICtrlCreateRadio ( "W10"  , 200 , 95 )
            Global $hRadio03 = GUICtrlCreateRadio ( "T.L. HP"  , 250 , 95 )
            Global $hRadio04 = GUICtrlCreateRadio ( "T.L. Wase"  , 310 , 95 )
            Global $hSymptLabel02 = GUICtrlCreateLabel ( "Nom du poste : " , 50 , 140 )
            Global $hInput01 = GUICtrlCreateInput ( "PPF" , 130 , 135 )
            Global $hSymptLabel03 = GUICtrlCreateLabel ( "Téléphone utilisateur : " , 250 , 140 )
            Global $hInput02 = GUICtrlCreateInput ( "0" , 360 , 135 )
            Global $hSymptLabel04 = GUICtrlCreateLabel ( "Site utilisateur : " , 530 , 140 )
            Global $hInput03 = GUICtrlCreateInput ( "MGEN/" , 610 , 135 )
            Global $hRish = _GUICtrlRichEdit_Create(    $GUI3,      "Symptôme(s) : " & @CRLF , _
                                                                    50 , 180 , 710 , 240 , BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL ) )
            Global $OKGO = GUICtrlCreateButton ( "Go" , 50, 450 )
            WinSetOnTop ($GUI3 , "" , 1)

            Global $ConsoleArea = GUICtrlCreateListView("Fiche consigne disponible pour votre symptôme :", 760 , 180 , 325 , 240 , $LVS_REPORT )
            _GUICtrlListView_SetColumnWidth ($ConsoleArea , 0 ,800 )
            GUISetState(@SW_HIDE, $GUI3)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")


_StartingChrome()
_ConfigueDelArray ()
While 1
    Func1000 ()
WEnd

Func Func1000()
    GUISetState(@SW_SHOW, $GUI3)

    While 1
        Local $hNMsg = GUIGetMsg($GUI3)
        Switch $hNMsg
            Case $OKGO
                Local $TelCheck = GUICtrlRead ($hInput02)
                If StringLen ($TelCheck) <= 9 Then
                    MsgBox ( $MB_TOPMOST , "Téléphone" , "Veuillez renseignez un numéro de téléphone valide s'il vous plait." )
                    ContinueLoop
                EndIf
                Local $HostNCheck = GUICtrlRead ($hInput01)
                WinSetOnTop($GUI3, "", 0)
                GUISetState(@SW_HIDE, $GUI3)
                $hTexte = _GUICtrlRichEdit_GetText($hRish)
                $hTexte = $hTexte&@CRLF&"Téléphone utilisateur : "&$TelCheck
                $hTexte = $hTexte&@CRLF&"Hostname : "&$HostNCheck
                _GUICtrlListView_DeleteAllItems ( $ConsoleArea )
                $ConsoleTexte = ""
                GUICtrlSetData ($hInput01 , "PPF" )
                GUICtrlSetData ($hInput02 , "0" )
                _GUICtrlRichEdit_SetText ( $hRish , "Symptôme(s) :"&@CRLF )
                Raz ()
                ExitLoop
            Case $GUI_EVENT_CLOSE;, $GUI_CLOSE_BUTTON
                GUISetState(@SW_HIDE, $GUI3)
                _GUICtrlListView_DeleteAllItems ( $ConsoleArea )
                $ConsoleTexte = ""
                GUICtrlSetData ($hInput01 , "PPF" )
                GUICtrlSetData ($hInput02 , "0" )
                _GUICtrlRichEdit_SetText ( $hRish , "Symptôme(s) :"&@CRLF )
                Raz ()
                ExitLoop
        EndSwitch

; IMPORTANT !! =============================<<
    If _GUICtrlRichEdit_IsModified($hRish) Then
            $hTexte = _GUICtrlRichEdit_GetText($hRish)
            _ReadString($hTexte, $sdk)
        _GUICtrlRichEdit_SetModified($hRish, false)
    EndIf
    Sleep(10)
    WEnd
EndFunc   ;==>Func1000

Func _ReadString($TexteStringToCheck, $sd)
    local $sMsg
    For $kw In $sd
        If StringRegExp($TexteStringToCheck, '\b(?i)' & $kw & '') Then _ConsoleForDebug ( $sd.item($kw) )
    Next
;~     _ConsoleForDebug ($sMsg)
EndFunc

Func _ConsoleForDebug ($sMsg)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sMsg = ' & $sMsg & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
    Local $test456 = _GUICtrlListView_FindInText ( $ConsoleArea , $sMsg )
        $sMsg = Exclusion ($sMsg)
        If $ConsoleTexte <> $sMsg And $sMsg <> "" And $test456 = -1 Then
            If $sMsg = "cons_view&consigne=49030" Then
                _ConsoleBIGIP ()
            EndIf
        $ConsoleTexte = $sMsg
                ;~ ==========================================Console============================================
                 _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg )
                 _GUICtrlListView_EnsureVisible ( $ConsoleArea , _GUICtrlListView_GetItemCount ( $ConsoleArea ) -1 )
                ;~ ==========================================/Console============================================

        EndIf
EndFunc   ;==>_ConsoleForDebug

Func Exclusion ($sMsg)
    If $sMsg = "cons_view&consigne=00001" Then
        $sMsg = ""
        $test1 = 1
    ElseIf $sMsg = "cons_view&consigne=00002" Then
        $sMsg = ""
        $test2 = 1
    EndIf
    If $test1 = 1 And $test2 = 1 And $test3 <> 1 Then
        _ConsoleForDebug_1 ("Themes Vpn-allo trouvé :")
        $sMsg = "cons_view&consigne=00003"
        $test3 = 1
    EndIf
    Return $sMsg
EndFunc

Func _ConsoleForDebug_1 ($sMsg)
                ;~ ==========================================Console============================================
                 _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg )
                 _GUICtrlListView_EnsureVisible ( $ConsoleArea , _GUICtrlListView_GetItemCount ( $ConsoleArea ) -1 )
                ;~ ==========================================/Console============================================
EndFunc   ;==>_ConsoleForDebug

Func Raz ()
    $test1 = 0
    $test2 = 0
    $test3 = 0
EndFunc

Func _ConsoleBIGIP ()
            ;~ ==========================================Console============================================
             Local $sMsg2 = "BigIP détecté !"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "Réparer Bigip :"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "cons_view&consigne=00004"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "Probleme connu de BigIP !"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "cons_view&consigne=00005"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "Mot de passe BigIP incorrect :"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "cons_view&consigne=00480"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
             $sMsg2 = "réinstallation de BigIP :"
             _GUICtrlListView_AddItem ( $ConsoleArea , $sMsg2 )
            ;~ ==========================================/Console============================================
EndFunc

Func _ConfigueDelArray ()
    SplashTextOn ("", "Construction documentation..." & @crlf & "  ", 500, 55, -1, 400, 49, "", 10)

    $sdk = ObjCreate("Scripting.Dictionary")

    For $i = 1 to 50000
        If StringLen ($i) < 2 Then $i = 0000&$i
        If StringLen ($i) < 3 Then $i = 000&$i
        If StringLen ($i) < 4 Then $i = 00&$i
        If StringLen ($i) < 5 Then $i = 0&$i

        If $i = 49030 Then
            $sdk.Add ("BigIP" , "cons_view&consigne=" & $i)
        ElseIf $i = 00001 Then
            $sdk.Add ("Vpn" , "cons_view&consigne=" & $i)
        ElseIf $i = 00002 Then
            $sdk.Add ("allo" , "cons_view&consigne=" & $i)
        ElseIf $i = 00015 Then
            $sdk.Add ("lol" , "cons_view&consigne=" & $i)
        Else
            $sdk.Add ("FicheConsigne" & $i, "cons_view&consigne=" & $i)
        EndIf
    Next

    SplashOff()

    #cs ; check
    $a = _list($sdk)
    _ArrayDisplay($a)
    #ce
EndFunc

Func _list($dico)
    Local $keys = $dico.Keys
    Local $items = $dico.Items
    Local $count = $dico.Count
    Local $ret[$count+1][2]
    $ret[0][0] = $count
    For $i = 1 To $count
        $ret[$i][0] = $keys[$i-1]
        $ret[$i][1] = $items[$i-1]
    Next
    Return $ret
EndFunc

Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
         If $WMNotifyTest = 1 Then
         ConsoleWrite ("; WMNotify () Is Working!!"&@CRLF)
         $WMNotifyTest += 1
         EndIf
    #forceref $hWnd, $iMsg, $wParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
    ; Local $tBuffer
    $hWndListView = $ConsoleArea
    If Not IsHWnd($ConsoleArea) Then $hWndListView = GUICtrlGetHandle($ConsoleArea)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _DebugPrint("$NM_CLICK" & @CRLF & _
                            "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    ;===================================================================================================
;~                  _WD_Navigate($sSession, "https://google.fr")
                    _WD_NewTab ( $sSession, "https://xxxxxxxxxxxxxxxxxxx/index.php?action=cons_view&consigne=49030")
                    ;===================================================================================================
                    _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
                Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
                    _GUICtrlListView_DeleteItem($ConsoleArea, DllStructGetData($tInfo, "Index"))
                    _FileWriteToLine ( @ScriptDir&"\Log.txt" , DllStructGetData($tInfo, "Index") , "" , True  )
                    _FileWriteToLine ( @ScriptDir&"\Data\Log02.txt" , DllStructGetData($tInfo, "Index") , "" , True  )
                    _FileWriteToLine ( @ScriptDir&"\Data\Log002.txt" , DllStructGetData($tInfo, "Index") , "" , True  )
                    _FileWriteToLine ( @ScriptDir&"\Log.txt" , DllStructGetData($tInfo, "Index") , "" , True )
                    _FileWriteToLine ( @ScriptDir&"\Data\Log02.txt" , DllStructGetData($tInfo, "Index") , "" , True  )
                    _FileWriteToLine ( @ScriptDir&"\Data\Log002.txt" , DllStructGetData($tInfo, "Index") , "" , True  )
                    _FileWriteToLine ( @ScriptDir&"\Log.txt" , DllStructGetData($tInfo, "Index") , "" , True  )
                    _FileWriteToLine ( @ScriptDir&"\Data\Log02.txt" , DllStructGetData($tInfo, "Index") , "" , True  )
                    _FileWriteToLine ( @ScriptDir&"\Data\Log002.txt" , DllStructGetData($tInfo, "Index") , "" , True  )

                    _DebugPrint("$NM_RDBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode & @CRLF & _
                            "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _
                            "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _
                            "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _
                            "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _
                            "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _
                            "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _
                            "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _
                            "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _
                            "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
                    ; No return value
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)
   ConsoleWrite ("_DebugPrint ()"&@CRLF)
    ConsoleWrite( _
            "!===========================================================" & @CRLF & _
            "+======================================================" & @CRLF & _
            "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _
            "+======================================================" & @CRLF)
EndFunc   ;==>_DebugPrint

Func _Exit ()
        WinSetOnTop ($GUI3 , "" , 0)
        Local $cExitYesNo = MsgBox ($MB_YESNO , "Quitter?" , "Voulez-vous quitter ?")
        If $cExitYesNo = "6" Then
            Exit
        Else
            WinSetOnTop ($GUI3 , "" , 1)
        EndIf
EndFunc


#Region Chrome

Func _StartingChrome ()
    _SetupChrome()
    _WD_Startup()
        If @error <> $_WD_ERROR_Success Then
            MsgBox ( 64 , "Erreur" , "Erreur de lancement de chrome." )
        EndIf
    $sSession = _WD_CreateSession($sDesiredCapabilities)
    _WD_NewTab ( $sSession, "https://xxxxxxxxxx/index.php?action=cons_view&consigne=49030")
EndFunc


Func _StopingChrome ()
    _WD_DeleteSession($sSession)
    _WD_Shutdown()
EndFunc

Func _SetupChrome()
    ; Set debug level or webdrivers
;~  $_WD_DEBUG = $_WD_DEBUG_None
    $_WD_DEBUG = $_WD_DEBUG_Info
    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"')

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false }}}}'
;~  $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false , "args":["--user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Default"] }}}}'
EndFunc

Func _WD_CaraNewTab ($UURLL = "Pas d'adresse")
    _WD_NewTab($sSession)
    Sleep(1000)
    Send("{F6}")
    Sleep(500)
    Send($UURLL)
    Send("{ENTER}")
EndFunc

#EndRegion

To test you could wait the rish input box type inside bigip and send 2 space. Then double click one of the item in the list view to open a new tab with a link. Same should happen at start. 

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

 

Link to comment
Share on other sites

As soon as I use new tab it bug. If I use only navigate it work. 

Ok, thing is my syntax. Once corrected the navigation work in other tabs. 

_WD_NewTab($sSession , Default , Default , "https://xxx/consigne=49030")

 

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

 

Link to comment
Share on other sites

1 hour ago, caramen said:

NVM wd is crashing again... in reproducer I don't know why it's never same behavior even at start. 

_WD_ExecuteScript: {"value":{"error":"unknown error","message":"unknown error: session deleted because of page crash\nf...

That's doesn't appear to me to be a webdriver crash. Rather, it's the webdriver returning an error that indicates that the web browser crashed.

Can't tell from the limited information you supplied, but I'm assuming that this is from the _WD_ExecuteScript call within _WD_NewTab.

Quote

_WD_NewTab ( $sSession, "https://xxxxxxxxxxxxxxxxxxx/index.php?action=cons_view&consigne=49030")

This is still the wrong syntax, so no wonder it isn't working for you. 🙄

Link to comment
Share on other sites

9 minutes ago, caramen said:

Ok, thing is my syntax. Once corrected the navigation work in other tabs. 

_WD_NewTab($sSession , Default , Default , "https://xxx/consigne=49030")

 

Thanks for your help Danp2. Sry for my retarded brain.

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

 

Link to comment
Share on other sites

Danp2,

First, wow on this UDF. You did a really good job with it.

 

I've tried searching for an example of how to run chrome completely hidden. I thought maybe headless mode would work, but it doesn't appear that the HTTPS site I'm going to operates properly when chrome is in headless mode, but I can't be totally sure. I'm writting some security automation tools for our ERP system, PLEX, which is a browser based ERP, and while they have webservice calls for getting data out of the system, they don't have any that help on setting security. My goal was to make an Autoit interface that would do some of the more common functions like "copy User A's security to User B"  by pulling up their security pages and just using element clicks to toggle security features.

When chrome is not headless, the code works. When its headless, it can't seem to get past the login screen. My next thought is to try to simply hide the browser by moving it off screen. I looked at _WD_Window and its 'rect' command, which says it allows GET and SET on the window's width, height, x, and y. This might work if i knew how to structure the $owRect values to set the position.

...
    $sSession = _WD_CreateSession($sDesiredCapabilities)
    $oWRect = _WD_Window($sSession, 'rect') ; Get the current session window coordinates
    $oWRect.Item('y') = -10000 ; Move the window way off the screen
    _WD_Window($sSession, 'rect',$oWRect); Set the window dimensions and position?
    ...

I tried the above command and it appears i'm goofing something up when i try to pass in $owRect as the option to _WD_Window.

Also...War Eagle.

 

 

Link to comment
Share on other sites

@Cyphon68,

Thanks for the kudos. According to the specs, you would need to do something like this --

_WD_Window($sSession, 'rect', '{"y":"-10000"}')

FWIW, _WD_Window isn't currently designed to accept an object for the $sOption parameter.

Quote

When chrome is not headless, the code works. When its headless, it can't seem to get past the login screen.

Not enough details to be able to suggest a fix. You could try running your script with the following settings --

$_WD_DEBUG = $_WD_DEBUG_Info
_WD_Option('console', 'c:\path\to\your\log\webdriver.log')

and post the resulting file here. Be sure to sanitize first to avoid giving out login details. 😅

Dan

P.S. WDE!

Link to comment
Share on other sites

well...I figured out the syntax, but it still didn't do what i was looking for, haha.

_WD_Window($sSession, 'rect', '{"y":-10000}')

the value needs to be numeric, rather than a string, but the driver doesn't allow for placing the window at invalid coordinates, it seems. In the end, I used WinGetHandle and set the state to @SW_HIDE

$wh_Browser = WinGetHandle("data:,")
    WinSetState($wh_Browser, "", @SW_HIDE)

 

Link to comment
Share on other sites

Yo Danp2, I tried a lot of things without success. 

Could you help me to act on this element please ? 

<textarea name="fraIdentification$icmtDE_SYMPAPPEL$t" rows="18" cols="20" id="fraIdentification_icmtDE_SYMPAPPEL_t" tabindex="12" class="iMemoTextArea iCompulsory iCtrlEna  iActiveFocus" onkeypress="iMmK(event,4000)" onkeyup="iMmK(event,4000)" onblur="iMmK(event,4000);iCtc(false, event);" onfocusout="javascript:iFTxtA=false;" onchange="iChkFt('fraIdentification_icmtDE_SYMPAPPEL_t','',-1,0); iCState();  iURc(this); " onfocus="iCtFs('fraIdentification_icmtDE_SYMPAPPEL_t', 'fraIdentification_icmtDE_SYMPAPPEL_t');;javascript:iFTxtA=true;" isititle="###" irst="True" onkeydown="iMmK(event,4000);iCtc(true, event);" style="z-index:75;position:absolute;height:240px;width:648px;top:317px;left:23px;"></textarea>
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//textarea[@id='fraIdentification_icmtDE_SYMPAPPEL_t']")
_WD_ElementAction($sSession, $sElement, 'value','Cara@hotmail.com4')

I could send you in dm the webpage of the site if you want to try.

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

 

Link to comment
Share on other sites

4 minutes ago, caramen said:

Yo Danp2, I tried a lot of things without success. 

Could you help me to act on this element please ? 

<textarea name="fraIdentification$icmtDE_SYMPAPPEL$t" rows="18" cols="20" id="fraIdentification_icmtDE_SYMPAPPEL_t" tabindex="12" class="iMemoTextArea iCompulsory iCtrlEna  iActiveFocus" onkeypress="iMmK(event,4000)" onkeyup="iMmK(event,4000)" onblur="iMmK(event,4000);iCtc(false, event);" onfocusout="javascript:iFTxtA=false;" onchange="iChkFt('fraIdentification_icmtDE_SYMPAPPEL_t','',-1,0); iCState();  iURc(this); " onfocus="iCtFs('fraIdentification_icmtDE_SYMPAPPEL_t', 'fraIdentification_icmtDE_SYMPAPPEL_t');;javascript:iFTxtA=true;" isititle="###" irst="True" onkeydown="iMmK(event,4000);iCtc(true, event);" style="z-index:75;position:absolute;height:240px;width:648px;top:317px;left:23px;"></textarea>

Try:

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//textarea[@id='fraIdentification_icmtDE_SYMPAPPEL_t']")

Then you can do whatever you want with the element. If that doesn't work, you didn't provide us enough code to help you.

Edited by Cyphon68
Link to comment
Share on other sites

2 minutes ago, Cyphon68 said:

If that doesn't work, you didn't provide us enough code to help you.

It is the full path of the area that I provide. There is no other code for this item. And watch my last edit ;) 

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

 

Link to comment
Share on other sites

If you can confirm 

'value','Cara@hotmail.com4'

Should set something in the input field then my answer is yes, it can't. Am trying something else rn.

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

 

Link to comment
Share on other sites

_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//textarea[@id='fraIdentification_icmtDE_SYMPAPPEL_t']\"}\n  (Session info: chrome=87.0.4280.88)","stacktrace":"Backtrace:\n\tOrdinal0 [0x003DC0C3+3326147]\n\tOrdinal0 [0x002C0851+2164817]\n\tOrdinal0 [0x00147298+619160]\n\tOrdinal0 [0x000CC070+114800]\n\tOrdinal0 [0x000EFC42+261186]\n\tOrdinal0 [0x000E1A2A+203306]\n\tOrdinal0 [0x000EE559+255321]\n\tOrdinal0 [0x000E189B+202907]\n\tOrdinal0 [0x000C3DF4+81396]\n\tOrdinal0 [0x000C4DEE+85486]\n\tOrdinal0 [0x000C4D79+85369]\n\tOrdinal0 [0x002D85DC+2262492]\n\tGetHandleVerifier [0x00562874+1487204]\n\tGetHandleVerifier [0x005623CD+1486013]\n\tGetHandleVerifier [0x0056A368+1518680]\n\tGetHandleVerifier [0x00562F4E+1488958]\n\tOrdinal0 [0x002CED0D+2223373]\n\tOrdinal0 [0x002DA12B+2269483]\n\tOrdinal0 [0x002DA26F+2269807]\n\tOrdinal0 [0x002EECB8+2354360]\n\tBaseThreadInitThunk [0x74B86359+25]\n\tRtlGetAppContainerNamedObjectPath [0x772E8944+228]\n\tRtlGetAppContainerNamedObjectPath [0x772E8914+180]\n\t(No symbol) [0x00000000]\n"}}
_WD_FindElement ==> No match: HTTP status = 404

 

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

 

Link to comment
Share on other sites

hmm...watch the element with inspect open (if you're using chrome. Does the ID change? can you find it using the following "contains" method?

 

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//textarea[contains(@id,'icmtDE_SYMPAPPEL')]")

 

Link to comment
Share on other sites

_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//textarea[contains(@id,'icmtDE_SYMPAPPEL')]\"}\n  (Session info: chrome=87.0.4280.88)","stacktrace":"Backtrace:\n\tOrdinal0 [0x003DC0C3+3326147]\n\tOrdinal0 [0x002C0851+2164817]\n\tOrdinal0 [0x00147298+619160]\n\tOrdinal0 [0x000CC070+114800]\n\tOrdinal0 [0x000EFC42+261186]\n\tOrdinal0 [0x000E1A2A+203306]\n\tOrdinal0 [0x000EE559+255321]\n\tOrdinal0 [0x000E189B+202907]\n\tOrdinal0 [0x000C3DF4+81396]\n\tOrdinal0 [0x000C4DEE+85486]\n\tOrdinal0 [0x000C4D79+85369]\n\tOrdinal0 [0x002D85DC+2262492]\n\tGetHandleVerifier [0x00562874+1487204]\n\tGetHandleVerifier [0x005623CD+1486013]\n\tGetHandleVerifier [0x0056A368+1518680]\n\tGetHandleVerifier [0x00562F4E+1488958]\n\tOrdinal0 [0x002CED0D+2223373]\n\tOrdinal0 [0x002DA12B+2269483]\n\tOrdinal0 [0x002DA26F+2269807]\n\tOrdinal0 [0x002EECB8+2354360]\n\tBaseThreadInitThunk [0x74B86359+25]\n\tRtlGetAppContainerNamedObjectPath [0x772E8944+228]\n\tRtlGetAppContainerNamedObjectPath [0x772E8914+180]\n\t(No symbol) [0x00000000]\n"}}
_WD_FindElement ==> No match: HTTP status = 404

 

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

 

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...