Jump to content

WebDriver UDF - Help & Support


Recommended Posts

For easy comprehension I don't use :

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": { "acceptInsecureCerts":true, "unhandledPromptBehavior": "ignore","goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false,"prefs": {"credentials_enable_service": false}, "args":["start-minimized","--user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Patrickun", "disable-infobars"]}}}}'

But if you use another profile like me 'partrickun' the problem is the same you can test it 

Maybe i make something tha't is wrong ?

Link to comment
Share on other sites

10 hours ago, Danp2 said:

@loulou2522 No idea what you're trying to say here. Did you try to locate the post that I referred you to previously? 🤨

State to reproduce my problem :

1- Create on Chrome a new profile ex patrickun

2' Launch the following proogramm and wait for exit 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_x64=toto.exe
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Res_Language=1036
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#Au3Stripper_Parameters=/sf /sv
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Opt("MustDeclareVars", 0)
Opt("MouseCoordMode", 1)
Opt("WinTitleMatchMode", 4)
Opt("SendKeyDelay", 100)
Opt("SendKeyDownDelay", 5)
Opt("CaretCoordMode", 0)
Opt("WinWaitDelay", 550)
Opt("MouseClickDelay", 20)
Opt("TrayIconDebug", 1)
Opt("PixelCoordMode", 0)

 Global  $echrome = True
 Global  $Ssession,$sDesiredCapabilities

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


;================================================
;Recherche d la langue du systéme d'exploitation
;=============================================


$_WD_ESCAPE_CHARS = '\\"'


    SetupChrome()

_WD_Startup()
Sleep(1000)


$sSession = _WD_CreateSession($sDesiredCapabilities)
;_WD_Window($sSession, 'Maximize')


    _WD_Navigate($sSession, "http://www.google.com")
    _WD_LoadWait($sSession,  500, -1)
    _WD_DeleteSession($sSession)
    _WD_Shutdown()

Func SetupChrome()
    ;======================================

    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')
    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": { "acceptInsecureCerts":true, "unhandledPromptBehavior": "ignore","goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false,"prefs": {"credentials_enable_service": false}, "args":["start-minimized","--user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Patrickun", "disable-infobars"]}}}}'

EndFunc   ;==>SetupChrome

3- Relaunch the programm again

image.png.58275e4e3a9ec262fa1e99981a8f6d63.pngWhen launching the programm again  you will have an error messsage 

This indicate that's chrome wasn't closed correctly.

4- If i use anaother way to close programm instead of 

_WD_DeleteSession($sSession)
   _WD_Shutdown()

 

    If ProcessExists("chrome.exe") Then
            $aList = WinList()
            For $i = 1 To $aList[0][0]
                If StringInStr($aList[$i][0], "Google Chrome") > 0 And BitAND(WinGetState($aList[$i][1]), 2) Then
                    Sleep(200)
                    WinClose($aList[$i][1])
                EndIf
            Next
        EndIf

    If ProcessExists("chromedriver.exe") Then
        Local $hWnd = WinWait("[REGEXPTITLE:(chromedriver.exe)]", "", 1)
        WinClose($hWnd)
    EndIf

With thats  command Chrome end correctly and if you relaunch another time the programm, you don't have an error message like below.

I explain my problem and hope it will be suffisant because i can't say more abour this problem 

Link to comment
Share on other sites

@loulou2522 I got all of that from your initial post. I guess your subsequent post was an attempt to add that this also occurs when you create a new profile, correct?

Quote

This has been discussed previously in this same thread and a solution that involved writing changes directly into some of the profile's files was provided.

I'm trying to get you to go find this prior post on your own. Have you done so?

Link to comment
Share on other sites

1 minute ago, Danp2 said:

@loulou2522 I got all of that from your initial post. I guess your subsequent post was an attempt to add that this also occurs when you create a new profile, correct?

I'm trying to get you to go find this prior post on your own. Have you done so?

Yes when creating a new profile and after when using this profile

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...