Jump to content

mLipok

MVPs
  • Posts

    11,495
  • Joined

  • Last visited

  • Days Won

    60

mLipok last won the day on June 4

mLipok had the most liked content!

About mLipok

  • Birthday 07/19/1978

Profile Information

  • Member Title
    I'm nitpicky sometimes.
  • Location
    Europe, Poland, Upper Silesia, Zabrze
  • Interests
    ¯\_(ツ)_/¯

Recent Profile Visitors

27,056 profile views

mLipok's Achievements

  1. Short story: The existing instance of firefox must be run via gecko driver. Gecko driver can be run via ShellExecute().
  2. Are you able to delete this user data dir ? Which AV software you are using ?
  3. You can chceck it also with standard SetupGecko() and stanard SetupChrome() but in such case you must to search for c:\Users\****\AppData\Local\Temp\chrome_url_fetcher_**** c:\Users\****\AppData\Local\Temp\rust_mozprofile**** c:\Users\****\AppData\Local\Temp\edge_BITS_**** and try to delete this directories after they are created by WebDriver (of course after you finish/stop your automation script) in such case you will notice that you may be not abloe to delete such directory as ESET AV is blocking them. Turning off HIPS module in ESET AV and restarting PC fix this issue but it is not recomended to turn of HIPS module. I am in contact with the developer of this antivirus software, but so far there is no indication of a positive solution to the problem.
  4. Have you ever encountered the problem of blocking the browser profile directory created by WebDriver? I have such problem from about 2 weeks with some version of ESET solutions. You can test it with "wd_demo.au3" with this modified SetupGecko() Func SetupGecko($bHeadless) _WD_Option('Driver', 'geckodriver.exe') Local $iPort = _WD_GetFreePort(4444, 4500) If @error Then Return SetError(@error, @extended, 0) _WD_Option('Port', $iPort) _WD_Option('DriverParams', '--port=' & $iPort & ' --log trace --marionette-port 2828') _WD_CapabilitiesStartup() _WD_CapabilitiesAdd('alwaysMatch', 'firefox') _WD_CapabilitiesAdd('browserName', 'firefox') _WD_CapabilitiesAdd('acceptInsecureCerts', True) ; REMARKS ; When using 32bit geckodriver.exe, you may need to set 'binary' option. ; This shouldn't be needed when using 64bit geckodriver.exe, ; but at the same time setting it is not affecting the script. Local $sPath = _WD_GetBrowserPath("firefox") If Not @error Then _WD_CapabilitiesAdd('binary', $sPath) ConsoleWrite("wd_demo.au3: _WD_GetBrowserPath() > " & $sPath & @CRLF) EndIf Local $s_Browser_Profile_Dir = @TempDir & '\Firefox_WD_Testing_Profile' DirCreate($s_Browser_Profile_Dir) __WD_ConsoleWrite($s_Browser_Profile_Dir) Sleep(3000) _WD_CapabilitiesAdd('args', '-profile') _WD_CapabilitiesAdd('args', $s_Browser_Profile_Dir) ; CHANGE TO PROPER DIRECTORY PATH If $bHeadless Then _WD_CapabilitiesAdd('args', '--headless') _WD_CapabilitiesDump(@ScriptLineNumber) ; dump current Capabilities setting to console - only for testing in this demo Local $sCapabilities = _WD_CapabilitiesGet() Return $sCapabilities EndFunc ;==>SetupGecko or this modified SetupChrome() Func SetupChrome($bHeadless) _WD_Option('Driver', 'chromedriver.exe') Local $iPort = _WD_GetFreePort(5555, 5600) If @error Then Return SetError(@error, @extended, 0) _WD_Option('Port', $iPort) Local $sTimeStamp = @YEAR & '-' & @MON & '-' & @MDAY & '_' & @HOUR & @MIN & @SEC _WD_Option('DriverParams', '--port=' & $iPort & ' --verbose --log-path="' & @ScriptDir & '\' & $sTimeStamp & '_chrome.log"') _WD_CapabilitiesStartup() _WD_CapabilitiesAdd('alwaysMatch', 'chrome') _WD_CapabilitiesAdd('browserName', 'chrome') _WD_CapabilitiesAdd('w3c', True) _WD_CapabilitiesAdd('acceptInsecureCerts', True) ;~ https://peter.sh/experiments/chromium-command-line-switches/ _WD_CapabilitiesAdd('detach', False) _WD_CapabilitiesAdd('args', 'user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win' & StringReplace(@OSArch, 'X', '') & '; ' & @CPUArch & ') AppleWebKit/537.36 (KHTML, like Gecko) Chrome/' & _WD_GetBrowserVersion('chrome') & ' Safari/537.36') _WD_CapabilitiesAdd('args', 'user-data-dir', @TempDir & '\Chrome_WD_Testing_Profile4') _WD_CapabilitiesAdd('args', '--profile-directory', Default) If $bHeadless Then _ _WD_CapabilitiesAdd('args', '--headless') If IsAdmin() Then _ _WD_CapabilitiesAdd('args', '--do-not-de-elevate') _WD_CapabilitiesDump(@ScriptLineNumber) ; dump current Capabilities setting to console - only for testing in this demo Local $sCapabilities = _WD_CapabilitiesGet() Return $sCapabilities EndFunc ;==>SetupChrome What are my results? First run ALL IS OK Each subsequent run gives: or
  5. Has anyone tried using the Smart Card Minidriver? Some references: https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn631754(v=vs.85)#smart-card-minidriver-specification-v707 https://download.microsoft.com/download/3/3/2/332fd70b-f04d-470a-a135-040350b9563f/sc-minidriver_specs_v7.07.docx
  6. @jpm maybe the same way like here: https://www.autoitscript.com/trac/autoit/ticket/3849#comment:2 @rikthhpgf2005 please use this script to post here result as text ; Dec, Int, Number Constants Global Const $NUMBER_AUTO = 0 Global Const $NUMBER_32BIT = 1 Global Const $NUMBER_64BIT = 2 Global Const $NUMBER_DOUBLE = 3 Global Const $tagOSVERSIONINFO = 'struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct' ConsoleWrite('Windows version: ' & _WinAPI_GetVersion() & @CRLF) Func _WinAPI_GetVersion() Local $tOSVI = DllStructCreate($tagOSVERSIONINFO) DllStructSetData($tOSVI, 1, DllStructGetSize($tOSVI)) Local $aCall = DllCall('kernel32.dll', 'bool', 'GetVersionExW', 'struct*', $tOSVI) If @error Or Not $aCall[0] Then Return SetError(@error, @extended, 0) MsgBox(0, "OSVERSIONINFO", "MajorVersion = " & DllStructGetData($tOSVI, "MajorVersion") & @CRLF & _ "MinorVersion = " & DllStructGetData($tOSVI, "MinorVersion") & @CRLF & _ "BuildNumber = " & DllStructGetData($tOSVI, "BuildNumber")) Return Number(DllStructGetData($tOSVI, "MajorVersion") & "." & DllStructGetData($tOSVI, "MinorVersion"), $NUMBER_DOUBLE) EndFunc ;==>_WinAPI_GetVersion or even this one: #AutoIt3Wrapper_Change2CUI=y ; Dec, Int, Number Constants Global Const $NUMBER_AUTO = 0 Global Const $NUMBER_32BIT = 1 Global Const $NUMBER_64BIT = 2 Global Const $NUMBER_DOUBLE = 3 Global Const $tagOSVERSIONINFO = "struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct" Global $sInformation = _ "AutoIt version: " & @AutoItVersion & @CRLF & _ "Windows version: " & _WinAPI_GetVersion() & @CRLF & " Build: " & @extended & @CRLF & _ "@OSVersion: " & @OSVersion & @CRLF & _ "@OSType: " & @OSType & @CRLF & _ "" ConsoleWrite($sInformation & @CRLF) ClipPut($sInformation) Func _WinAPI_GetVersion() Local $tOSVI = DllStructCreate($tagOSVERSIONINFO) DllStructSetData($tOSVI, 1, DllStructGetSize($tOSVI)) Local $aCall = DllCall('kernel32.dll', 'bool', 'GetVersionExW', 'struct*', $tOSVI) If @error Or Not $aCall[0] Then Return SetError(@error, @extended, 0) MsgBox(0, "OSVERSIONINFO", "MajorVersion = " & DllStructGetData($tOSVI, "MajorVersion") & @CRLF & _ "MinorVersion = " & DllStructGetData($tOSVI, "MinorVersion") & @CRLF & _ "BuildNumber = " & DllStructGetData($tOSVI, "BuildNumber")) Return SetError(0, Number(DllStructGetData($tOSVI, "BuildNumber")), Number(DllStructGetData($tOSVI, "MajorVersion") & "." & DllStructGetData($tOSVI, "MinorVersion"), $NUMBER_DOUBLE)) EndFunc ;==>_WinAPI_GetVersion
  7. You can test it with wd_demo.au3 by replacing the SetupGecko() function with this following one: Func SetupGecko($bHeadless) _WD_Option('Driver', 'geckodriver.exe') Local $iPort = _WD_GetFreePort(4444, 4500) If @error Then Return SetError(@error, @extended, 0) _WD_Option('Port', $iPort) _WD_Option('DriverParams', '--port=' & $iPort & ' --log-no-truncate') ; https://firefox-source-docs.mozilla.org/testing/geckodriver/Flags.html ;~ Local $sCapabilities = '{"capabilities": {"alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts":true}}}' _WD_CapabilitiesStartup() _WD_CapabilitiesAdd('alwaysMatch', 'firefox') _WD_CapabilitiesAdd('browserName', 'firefox') _WD_CapabilitiesAdd('acceptInsecureCerts', True) ; REMARKS ; When using 32bit geckodriver.exe, you may need to set 'binary' option. ; This shouldn't be needed when using 64bit geckodriver.exe, ; but at the same time setting it is not affecting the script. Local $sPath = _WD_GetBrowserPath("firefox") If Not @error Then _WD_CapabilitiesAdd('binary', $sPath) ConsoleWrite("wd_demo.au3: _WD_GetBrowserPath() > " & $sPath & @CRLF) EndIf Local $sLogDir = @ScriptDir & "\Log\" DirCreate($sLogDir) Local $sTimeStamp = @YEAR & '-' & @MON & '-' & @MDAY & '_' & @HOUR & @MIN & @SEC Local $sLogFile = $sLogDir & $sTimeStamp & '_Au3WebDriver_firefox.log' If $sLogFile Then EnvSet('GECKODRIVER_LOG', $sLogFile) ConsoleWrite("- GECKODRIVER_LOG: " & EnvGet('GECKODRIVER_LOG') & @CRLF) EnvSet('MOZ_LOG_FILE', $sLogFile) ConsoleWrite("- MOZ_LOG_FILE: " & EnvGet('MOZ_LOG_FILE') & @CRLF) _WD_CapabilitiesAdd('prefs', 'logging.config.clear_on_startup', True) ; https://firefox-source-docs.mozilla.org/xpcom/logging.html _WD_CapabilitiesAdd('prefs', 'logging.config.LOG_FILE', $sLogFile) ; https://firefox-source-docs.mozilla.org/xpcom/logging.html _WD_CapabilitiesAdd('prefs', 'logging.config.add_timestamp', True) ; https://firefox-source-docs.mozilla.org/xpcom/logging.html _WD_CapabilitiesAdd('prefs', 'logging.config.sync', True) ; https://firefox-source-docs.mozilla.org/xpcom/logging.html _WD_CapabilitiesAdd('prefs', 'logging.config.profilerstacks', True) ; https://firefox-source-docs.mozilla.org/xpcom/logging.html _WD_CapabilitiesAdd('args', 'service_log_path', $sLogFile) _WD_CapabilitiesAdd('env', "MOZ_LOG", "nsHttp:5") _WD_CapabilitiesAdd('env', "MOZ_LOG_FILE", $sLogFile) EndIf If $bHeadless Then _WD_CapabilitiesAdd('args', '--headless') _WD_CapabilitiesDump(@ScriptLineNumber) ; dump current Capabilities setting to console - only for testing in this demo Local $sCapabilities = _WD_CapabilitiesGet() Return $sCapabilities EndFunc ;==>SetupGecko
  8. even using MOZ_LOG accordingly to: https://developer.mozilla.org/en-US/docs/Web/WebDriver/Reference/Capabilities/firefoxOptions#example in this way If $sLogFile Then _WD_CapabilitiesAdd('env', "MOZ_LOG", "nsHttp:5") _WD_CapabilitiesAdd('env', "MOZ_LOG_FILE", $sLogFile) EndIf was not helpfull.
  9. So I was able to get this partialy working with using 'prefs' accordingly to https://firefox-source-docs.mozilla.org/xpcom/logging.html: _WD_CapabilitiesStartup() _WD_CapabilitiesAdd('alwaysMatch', 'firefox') _WD_CapabilitiesAdd('browserName', 'firefox') _WD_CapabilitiesAdd('acceptInsecureCerts', True) _WD_CapabilitiesAdd('prefs', 'logging.config.clear_on_startup', True) ; https://firefox-source-docs.mozilla.org/xpcom/logging.html _WD_CapabilitiesAdd('prefs', 'logging.config.LOG_FILE', $sLogFile) ; https://firefox-source-docs.mozilla.org/xpcom/logging.html _WD_CapabilitiesAdd('prefs', 'logging.config.add_timestamp', True) ; https://firefox-source-docs.mozilla.org/xpcom/logging.html _WD_CapabilitiesAdd('prefs', 'logging.config.sync', True) ; https://firefox-source-docs.mozilla.org/xpcom/logging.html _WD_CapabilitiesAdd('prefs', 'logging.config.profilerstacks', True) ; https://firefox-source-docs.mozilla.org/xpcom/logging.html If $bHeadless Then _WD_CapabilitiesAdd('args', '--headless') _WD_CapabilitiesAdd('args', '-profile') _WD_CapabilitiesAdd('args', @LocalAppDataDir & '\Mozilla\Firefox\Profiles\WD_Testing_Profile') and with EnvSet() accordingly to: https://firefox-source-docs.mozilla.org/xpcom/logging.html in this way: EnvSet('MOZ_LOG_FILE', $sLogFile) instead: EnvSet('GECKODRIVER_LOG', $sLogFile) both ways 'prefs' and 'ENV' works partialy as the file is created but is empty - 0 bytes length. I'm stuck here and I'd like to ask for help in solving this puzzle.
  10. I was trying to use: If $sLogFile Then $sDriverParams &= ' --log-path="' & $sLogFile & '"' _WD_Option('DriverParams', $sDriverParams) on FireFox with geckodriver I get the same error as: So I start to search and found: https://geckodriver.org/how-do-i-enable-logging-for-geckodriver/ But I decied to use : ConsoleWrite("- " & EnvGet('GECKODRIVER_LOG') & @CRLF) ConsoleWrite("- " & EnvSet('GECKODRIVER_LOG', $sLogFile) & @CRLF) ConsoleWrite("- " & EnvGet('GECKODRIVER_LOG') & @CRLF) ConsoleWrite("- $sLogFile = " & $sLogFile & @CRLF) unfortunately it didn't work. I even use: and still didn't work. Any suggestion how to properly set log file for geckodriver ? using AutoIt ?
  11. I think they're changing the default behavior. But they also provide override switches here: https://chromium-review.googlesource.com/c/chromium/src/+/6515318/11/chrome/common/chrome_switches.cc EDIT: btw. the --do-not-de-elevate switch was provide in MsEdge in 2019 and still is there
  12. @n3wbie could you be so nice and check: https://github.com/Danp2/au3WebDriver/issues/532#issuecomment-3054090565
  13. added: _WinAPI_ShellGetFileInfo.au3 I can't remember how to complete the _WinAPI_DestroyIcon documentation "as a reference to _WinAPI_ShellGetFileInfo.au3" I hope someone else will complete this soon.
×
×
  • Create New...