loulou2522 Posted November 11, 2019 Share Posted November 11, 2019 Thanks Danp2, THat's work perfectly. Only one thing with the dialogbox can i use _WD_Alert to enter a name of file ? Link to comment Share on other sites More sharing options...
Danp2 Posted November 11, 2019 Author Share Posted November 11, 2019 No, you'll use standard Autoit commands to interact with the file selection dialog. I'll see if I can create another helper function to handle the whole process. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
loulou2522 Posted November 12, 2019 Share Posted November 12, 2019 It's impossible to use autoit automation because the programm blocks on this instruction $Upload = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='files[]' and @id='inputFile']") $sJsonElement = '{"' & $_WD_ELEMENT_ID & '":"' & $Upload & '"}' $sResponse = _WD_ExecuteScript($sSession, "return arguments[0].click()", $sJsonElement) Here is the debug log __WD_Post: URL=HTTP://127.0.0.1:17556/session/1D4582A5-9360-41BA-8230-44A5E63F2259/element; $sData={"using":"xpath","value":"//input[@name='files[]' and @id='inputFile']"} __WD_Post: StatusCode=200; ResponseText={"value":{"ELEMENT":"2b5201cf-8262-43f0-bead-d6bc308d54af","element-6066-11e4-a52e-4f735466cecf":"2b5201cf-8262-43f0-bead-d6bc308d54af"}} _WD_FindElement: {"value":{"ELEMENT":"2b5201cf-8262-43f0-bead-d6bc308d54af","element-6066-11e4-a52e-4f735466cecf":"2b5201cf-8262-43f0-bead-d6bc308d54af"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:17556/session/1D4582A5-9360-41BA-8230-44A5E63F2259/element; $sData={"using":"xpath","value":"//input[@name='files[]' and @id='inputFile']"} __WD_Post: StatusCode=200; ResponseText={"value":{"ELEMENT":"2b5201cf-8262-43f0-bead-d6bc308d54af","element-6066-11e4-a52e-4f735466cecf":"2b5201cf-8262-43f0-bead-d6bc308d54af"}} _WD_FindElement: {"value":{"ELEMENT":"2b5201cf-8262-43f0-bead-d6bc308d54af","element-6066-11e4-a52e-4f735466cecf":"2b5201cf-8262-43f0-bead-d6bc308d54af"}} __WD_Post: URL=HTTP://127.0.0.1:17556/session/1D4582A5-9360-41BA-8230-44A5E63F2259/execute/sync; $sData={"script":"return arguments[0].click()", "args":[{"element-6066-11e4-a52e-4f735466cecf":"2b5201cf-8262-43f0-bead-d6bc308d54af"}]} __WD_Post: StatusCode=0; ResponseText=0 __WD_Post ==> Send / Recv error _WD_ExecuteScript: 0  Link to comment Share on other sites More sharing options...
Danp2 Posted November 12, 2019 Author Share Posted November 12, 2019 @loulou2522 Please make sure that you have the latest version of the WinHTTP UDF, which should be v1.6.4.2 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
loulou2522 Posted November 12, 2019 Share Posted November 12, 2019 OK i download the winhttp v 1.6.4.2 But the programm block on the window OpenFiledialog. It seems that's this window is modal. Link to comment Share on other sites More sharing options...
Danp2 Posted November 12, 2019 Author Share Posted November 12, 2019 (edited) @loulou2522 Not sure how to help you at this point because you haven't provided enough details for us to replicate your issue. Edit: I've figured out how this is supposed to work. I'll post a full example later on. Edited November 12, 2019 by Danp2 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted November 12, 2019 Author Share Posted November 12, 2019 @loulou2522 Please try this code and report back (you'll need to modify the filename variable for your environment) -- expandcollapse popup#include "wd_core.au3" Local $sDesiredCapabilities Local $iIndex Local $sSession Local $sFilename = 'c:\DBAR_Ver2.txt' ;SetupGecko() SetupChrome() _WD_Startup() $_WD_ESCAPE_CHARS = '\\"' $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://cgi-lib.berkeley.edu/ex/fup.html") _WD_SelectUploadFile($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='upfile']",$sFilename) Func SetupGecko() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' 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 }, "goog:loggingPrefs": {"browser":"ALL"}}}}' EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WD_SelectUploadFile ; Description ...: ; Syntax ........: _WD_SelectUploadFile($sSession, $sStrategy, $sSelector, $sFilename) ; Parameters ....: $sSession - Session ID from _WDCreateSession ; $sStrategy - Locator strategy. See defined constant $_WD_LOCATOR_* for allowed values ; $sSelector - Value to find ; $sFilename - String representing full path of file to upload ; Return values .: Success - 1 ; Failure - 0 ; @ERROR - $_WD_ERROR_Success ; - $_WD_ERROR_Exception ; - $_WD_ERROR_NoMatch ; @EXTENDED - WinHTTP status code ; Author ........: Dan Pollak ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WD_SelectUploadFile($sSession, $sStrategy, $sSelector, $sFilename) Local Const $sFuncName = "_WD_SelectUploadFile" Local $sResponse, $sResult, $sJsonElement, $oJson Local $sElement = _WD_FindElement($sSession, $sStrategy, $sSelector) Local $iErr = @error If $iErr = $_WD_ERROR_Success Then $sResult = _WD_ElementAction($sSession, $sElement, 'value', $sFilename) $iErr = @error If $iErr = $_WD_ERROR_Success Then $sJsonElement = '{"' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}' $sResponse = _WD_ExecuteScript($sSession, "return arguments[0].files.length", $sJsonElement) $oJson = Json_Decode($sResponse) $sResult = Json_Get($oJson, "[value]") EndIf EndIf If $_WD_DEBUG = $_WD_DEBUG_Info Then ConsoleWrite($sFuncName & ': ' & $sResult & " file(s) selected" & @CRLF) EndIf Return SetError(__WD_Error($sFuncName, $iErr), $_WD_HTTPRESULT, $sResult) EndFunc  Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
loulou2522 Posted November 13, 2019 Share Posted November 13, 2019 Hi Damp Here is the result of your programm _WDStartup: OS: WIN_10 WIN32_NT 18362 _WDStartup: AutoIt: 3.3.14.5 _WDStartup: WD.au3: 0.1.0.21 _WDStartup: Driver: chromedriver.exe _WDStartup: Params: --log-path="C:\Users\Patrick\Desktop\TESTPOSTFINANCE\ChromeDriver\chrome.log" _WDStartup: Port: 9515 __WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }, "goog:loggingPrefs": {"browser":"ALL"}}}} __WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"78.0.3904.97","chrome":{"chromedriverVersion":"78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904@{#800})","userDataDir":"C:\\Users\\Patrick\\AppData\\Local\\Temp\\scoped_dir15260_1274292444"},"goog:chromeOptions":{"debuggerAddress":"localhost:50840"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows nt","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"},"sessionId":"81ba15e5ec9e04f3c1e0996579f7803f"}} _WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"78.0.3904.97","chrome":{"chromedriverVersion":"78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904@{#800})","userDataDir":"C:\\Users\\Patrick\\AppData\\Local\\Temp\\scoped_dir15260_1274292444"},"goog:chromeOptions":{"debuggerAddress":"localhost:50840"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows nt","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"},"sessionId":"81ba15e5ec9e04f3c1e0996579f7803f"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/81ba15e5ec9e04f3c1e0996579f7803f/url; $sData={"url":"https://cgi-lib.berkeley.edu/ex/fup.html"} __WD_Post: StatusCode=200; ResponseText={"value":null} _WD_Navigate: {"value":null} __WD_Post: URL=HTTP://127.0.0.1:9515/session/81ba15e5ec9e04f3c1e0996579f7803f/element; $sData={"using":"xpath","value":"//input[@name='upfile']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"4bb969f7-1bba-4b0e-b717-ef3e8aa263bb"}} _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"4bb969f7-1bba-4b0e-b717-ef3e8aa263bb"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/81ba15e5ec9e04f3c1e0996579f7803f/element/4bb969f7-1bba-4b0e-b717-ef3e8aa263bb/value; $sData={"id":"4bb969f7-1bba-4b0e-b717-ef3e8aa263bb", "text":"C:\\Users\\Patrick\\Desktop\\CV.EXEMPT.TXT"} __WD_Post: StatusCode=200; ResponseText={"value":null} _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/81ba15e5ec9e04f3c1e0996579f7803f/execute/sync; $sData={"script":"return arguments[0].files.length", "args":[{"element-6066-11e4-a52e-4f735466cecf":"4bb969f7-1bba-4b0e-b717-ef3e8aa263bb"}]} __WD_Post: StatusCode=200; ResponseText={"value":1} _WD_ExecuteScript: {"value":1} _WD_SelectUploadFile: 1 file(s) selected _WD_SelectUploadFile ==> Success +>08:23:27 AutoIt3.exe ended.rc:0 +>08:23:27 AutoIt3Wrapper Finished. >Exit code: 0 Time: 10.05 And integrating in my programm expandcollapse popup_WDStartup: WD.au3: 0.1.0.21 _WDStartup: Driver: MicrosoftWebDriver.exe _WDStartup: Params: --verbose _WDStartup: Port: 17556 __WD_Post: URL=HTTP://127.0.0.1:17556/session; $sData={"capabilities":{}} __WD_Post: StatusCode=200; ResponseText={"value":{"sessionId":"7CED8404-8F06-45BF-9DF3-DC06A3EB80D3","capabilities":{"acceptInsecureCerts":false,"browserName":"MicrosoftEdge","browserVersion":"44.18362.387.0","pageLoadStrategy":"normal","platformName":"windows","setWindowRect":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"proxy":{}}}} _WD_CreateSession: {"value":{"sessionId":"7CED8404-8F06-45BF-9DF3-DC06A3EB80D3","capabilities":{"acceptInsecureCerts":false,"browserName":"MicrosoftEdge","browserVersion":"44.18362.387.0","pageLoadStrategy":"normal","platformName":"windows","setWindowRect":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"proxy":{}}}} __WD_Post: URL=HTTP://127.0.0.1:17556/session/7CED8404-8F06-45BF-9DF3-DC06A3EB80D3/window/maximize; $sData={} __WD_Post: StatusCode=200; ResponseText={"value":{"height":744,"width":1382,"x":0,"y":0}} _WD_Window: {"value":{"height":744,"width":1382,"x":0,"y":0}}... __WD_Post: URL=HTTP://127.0.0.1:17556/session/7CED8404-8F06-45BF-9DF3-DC06A3EB80D3/url; $sData={"url":"https://isotest.postfinance.ch/corporates/login?locale=fr"} __WD_Post: StatusCode=200; ResponseText={"value":null} _WD_Navigate: {"value":null} __WD_Post: URL=HTTP://127.0.0.1:17556/session/7CED8404-8F06-45BF-9DF3-DC06A3EB80D3/element; $sData={"using":"xpath","value":"//input[@id='username']"} __WD_Post: StatusCode=200; ResponseText={"value":{"ELEMENT":"4dccf855-4994-40dc-a7f1-1b42910a65e0","element-6066-11e4-a52e-4f735466cecf":"4dccf855-4994-40dc-a7f1-1b42910a65e0"}} _WD_FindElement: {"value":{"ELEMENT":"4dccf855-4994-40dc-a7f1-1b42910a65e0","element-6066-11e4-a52e-4f735466cecf":"4dccf855-4994-40dc-a7f1-1b42910a65e0"}} __WD_Post: URL=HTTP://127.0.0.1:17556/session/7CED8404-8F06-45BF-9DF3-DC06A3EB80D3/element/4dccf855-4994-40dc-a7f1-1b42910a65e0/value; $sData={"id":"4dccf855-4994-40dc-a7f1-1b42910a65e0", "text":"loulou2522"} __WD_Post: StatusCode=200; ResponseText={"value":null} _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:17556/session/7CED8404-8F06-45BF-9DF3-DC06A3EB80D3/element; $sData={"using":"xpath","value":"//input[@id='password']"} __WD_Post: StatusCode=200; ResponseText={"value":{"ELEMENT":"d3540a36-86bc-4fd9-95ba-5ae25ab14024","element-6066-11e4-a52e-4f735466cecf":"d3540a36-86bc-4fd9-95ba-5ae25ab14024"}} _WD_FindElement: {"value":{"ELEMENT":"d3540a36-86bc-4fd9-95ba-5ae25ab14024","element-6066-11e4-a52e-4f735466cecf":"d3540a36-86bc-4fd9-95ba-5ae25ab14024"}} __WD_Post: URL=HTTP://127.0.0.1:17556/session/7CED8404-8F06-45BF-9DF3-DC06A3EB80D3/element/d3540a36-86bc-4fd9-95ba-5ae25ab14024/value; $sData={"id":"d3540a36-86bc-4fd9-95ba-5ae25ab14024", "text":"Isabelle01#"} __WD_Post: StatusCode=200; ResponseText={"value":null} _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:17556/session/7CED8404-8F06-45BF-9DF3-DC06A3EB80D3/element; $sData={"using":"xpath","value":"//button[@id='action.login']"} __WD_Post: StatusCode=200; ResponseText={"value":{"ELEMENT":"d251ce1a-6e51-49d0-8673-1c6cde81a7c8","element-6066-11e4-a52e-4f735466cecf":"d251ce1a-6e51-49d0-8673-1c6cde81a7c8"}} _WD_FindElement: {"value":{"ELEMENT":"d251ce1a-6e51-49d0-8673-1c6cde81a7c8","element-6066-11e4-a52e-4f735466cecf":"d251ce1a-6e51-49d0-8673-1c6cde81a7c8"}} __WD_Post: URL=HTTP://127.0.0.1:17556/session/7CED8404-8F06-45BF-9DF3-DC06A3EB80D3/element/d251ce1a-6e51-49d0-8673-1c6cde81a7c8/click; $sData={"id":"d251ce1a-6e51-49d0-8673-1c6cde81a7c8"} __WD_Post: StatusCode=200; ResponseText={"value":null} _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:17556/session/7CED8404-8F06-45BF-9DF3-DC06A3EB80D3/element; $sData={"using":"xpath","value":"//input[@name='files[]' and @id='inputFile']"} __WD_Post: StatusCode=200; ResponseText={"value":{"ELEMENT":"9b213276-9aab-4f29-8539-cad63397390d","element-6066-11e4-a52e-4f735466cecf":"9b213276-9aab-4f29-8539-cad63397390d"}} _WD_FindElement: {"value":{"ELEMENT":"9b213276-9aab-4f29-8539-cad63397390d","element-6066-11e4-a52e-4f735466cecf":"9b213276-9aab-4f29-8539-cad63397390d"}} __WD_Post: URL=HTTP://127.0.0.1:17556/session/7CED8404-8F06-45BF-9DF3-DC06A3EB80D3/element/9b213276-9aab-4f29-8539-cad63397390d/value; $sData={"id":"9b213276-9aab-4f29-8539-cad63397390d", "text":"C:\inetpub\wwwroot\sepach\doc\TESTSWISSSEPAVIR.xml"} __WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"An unknown error occurred while processing the specified command.","stacktrace":""}} _WD_ElementAction: {"value":{"error":"unknown error","message":"An unknown error occurred while processing the specifie... _WD_ElementAction ==> Webdriver Exception: {"value":{"error":"unknown error","message":"An unknown error occurred while processing the specified command.","stacktrace":""}} _WD_SelectUploadFile: file(s) selected _WD_SelectUploadFile ==> Webdriver Exception +>08:34:14 AutoIt3.exe ended.rc:0 +>08:34:14 AutoIt3Wrapper Finished. >Exit code: 0 Time: 21.93 The main difference is that in the web page cliicking on input file open the open dialog window. if you want i will send you by separate email the programm because the access of this web page is protected ? Thanks for your great help Link to comment Share on other sites More sharing options...
Danp2 Posted November 13, 2019 Author Share Posted November 13, 2019 4 hours ago, loulou2522 said: The main difference is that in the web page cliicking on input file open the open dialog window. You didn't implement the solution I posted within your code. Please revise your code and then try again. Hint: My version no longer clicks on the input element Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
loulou2522 Posted November 13, 2019 Share Posted November 13, 2019 Here is your add-on to add to wd_core3 expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name ..........: _WD_SelectUploadFile ; Description ...: ; Syntax ........: _WD_SelectUploadFile($sSession, $sStrategy, $sSelector, $sFilename) ; Parameters ....: $sSession - Session ID from _WDCreateSession ; $sStrategy - Locator strategy. See defined constant $_WD_LOCATOR_* for allowed values ; $sSelector - Value to find ; $sFilename - String representing full path of file to upload ; Return values .: Success - 1 ; Failure - 0 ; @ERROR - $_WD_ERROR_Success ; - $_WD_ERROR_Exception ; - $_WD_ERROR_NoMatch ; @EXTENDED - WinHTTP status code ; Author ........: Dan Pollak ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WD_SelectUploadFile($sSession, $sStrategy, $sSelector, $sFilename) Local Const $sFuncName = "_WD_SelectUploadFile" Local $sResponse, $sResult, $sJsonElement, $oJson Local $sElement = _WD_FindElement($sSession, $sStrategy, $sSelector) Local $iErr = @error If $iErr = $_WD_ERROR_Success Then $sResult = _WD_ElementAction($sSession, $sElement, 'value', $sFilename) $iErr = @error If $iErr = $_WD_ERROR_Success Then $sJsonElement = '{"' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}' $sResponse = _WD_ExecuteScript($sSession, "return arguments[0].files.length", $sJsonElement) $oJson = Json_Decode($sResponse) $sResult = Json_Get($oJson, "[value]") EndIf EndIf If $_WD_DEBUG = $_WD_DEBUG_Info Then ConsoleWrite($sFuncName & ': ' & $sResult & " file(s) selected" & @CRLF) EndIf Return SetError(__WD_Error($sFuncName, $iErr), $_WD_HTTPRESULT, $sResult) EndFunc    I test all These function, they works with Chrome , Edge and Firefox all in the last version Thanls to Damp for this excellent programm of automation , it's really a great add-ons Link to comment Share on other sites More sharing options...
Danp2 Posted November 13, 2019 Author Share Posted November 13, 2019 Thanks for reporting back on your success. FWIW, this will be added to wd_helper (not wd_core) since it's not one of the "core" webdriver functions. Also, the function name may change in the final version. Not sure about _WD_SelectUploadFile; Considering _WD_SelectFiles instead. Anyone else have suggestions? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CYCho Posted November 16, 2019 Share Posted November 16, 2019 (edited) Several months ago I encountered a version mismatch error and I had to update my chromedriver manually. Ever since then it has become my habit to check the compatibility once in a while. I wish that Google would make the chromedriver updated automatically when the chrome browser is updated. The following code checks if my chromedriver is compatible with my chrome browser and, if necessary, downloads a compatible chromedriver. I am planning to put this in a scheduled task so that I may not worry about version mismatch any more. Any suggestion for improvement would be welcome. expandcollapse popup#include <IE.au3> #include <InetConstants.au3> #include <FileConstants.au3> #include "wd_core.au3" ;#include <Array.au3> $sChromeVersion = FileGetVersion("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") $sDriverVersion = "" If FileExists(@ScriptDir & "\chromedriver.exe") Then ; chromedriver version cannot be retrieved by FileGetVersion() $_WD_DEBUG = $_WD_Debug_None _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args": ["headless"]}}}}' _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_DeleteSession($sSession) _WD_Shutdown() $sLog = FileRead(@ScriptDir & "\chrome.log") $aLog = StringRegExp($sLog, "Starting ChromeDriver (.*) \(", 1) If Not IsArray($aLog) Then Exit EndIf $sDriverVersion = $aLog[0] EndIf ;MsgBox(0,'Chromedriver', 'Chrome Version: ' & $sChromeVersion & @CRLF & 'Driver Version: ' & $sDriverVersion) $oIE = _IECreate("https://sites.google.com/a/chromium.org/chromedriver/downloads", 0, 0, 1) If @error Then Exit MsgBox(0, '', 'Cannot create an IE object. @error: ' & @error) $sText = _IEBodyReadText($oIE) _IEQuit($oIE) If $sText = "" Then Exit MsgBox(0, '', 'Cannot read the body text. @error: ' & @error) $aText = StringSplit($sText, @CRLF, 1) ;_ArrayDisplay($aText) $sVersion = "" For $i = 1 To $aText[0] If $aText[$i] = "Supports Chrome version " & Number($sChromeVersion) Then $sVersion = StringReplace($aText[$i-2], "ChromeDriver ", "") ExitLoop EndIf Next If $sDriverVersion = $sVersion Then MsgBox(0, 'Chromedriver', 'No need to update chromedriver!') Exit EndIf FileMove(@ScriptDir & "\chromedriver_win32.zip", @ScriptDir & "\chromedriver_win32_old.zip", $FC_OVERWRITE) $sZipFile = @ScriptDir & "\chromedriver_win32.zip" $iSize = InetGet("https://chromedriver.storage.googleapis.com/" & $sVersion & "/chromedriver_win32.zip", $sZipFile, $INET_FORCERELOAD, $INET_DOWNLOADWAIT) ;https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_win32.zip If $iSize> 0 Then FileMove(@ScriptDir & "\chromedriver.exe", @ScriptDir & "\chromedriver_old.exe", $FC_OVERWRITE) $sDriverPath = @ScriptDir $oShell = ObjCreate ("Shell.Application") $FilesInZip = $oShell.NameSpace($sZipFile).items $oShell.NameSpace($sDriverPath).CopyHere($FilesInZip,0x4) MsgBox(0, 'Chromedriver', 'Chromedriver version ' & $sVersion & ' was installed.') Else FileMove(@ScriptDir & "\chromedriver_win32_old.zip", @ScriptDir & "\chromedriver_win32.zip", $FC_OVERWRITE) MsgBox(0, 'Chromedriver', 'Download of chromedriver zip file failed.') EndIf  Edited November 16, 2019 by CYCho zPlayer - A Small Audio and Video Player   Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
Danp2 Posted November 16, 2019 Author Share Posted November 16, 2019 @CYCho Here's an alternative method of getting the Chrome version details -- #include <Inet.au3> #include <String.au3> $sChromeVersion = FileGetVersion("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") ConsoleWrite("Chrome version - " & $sChromeVersion & @CRLF) $iPID = Run(@ScriptDir & "\chromedriver.exe --version", @ScriptDir, @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($iPID) $sOutput = StdoutRead($iPID) $aResult = _StringBetween($sOutput, "ChromeDriver ", " (") $sChromeDriver = @error ? "" : $aResult[0] ConsoleWrite("Chromedriver version -- " & $sChromeDriver & @CRLF) $sChromeVersionShort = StringLeft($sChromeVersion, StringInStr($sChromeVersion, ".", 0, -1) - 1) $sChromeDriverLatest = _INetGetSource("https://chromedriver.storage.googleapis.com/LATEST_RELEASE_" & $sChromeVersionShort) ConsoleWrite("Chromedriver latest -- " & $sChromeDriverLatest & @CRLF) If $sChromeDriver <> $sChromeDriverLatest Then ConsoleWrite("ChromeDriver upgrade needed!" & @CRLF) EndIf  CYCho 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
CYCho Posted November 16, 2019 Share Posted November 16, 2019 (edited) @Danp2 Your knowledge and creativity always amazes me. I absolutley like your alternative method. My revised code here: expandcollapse popup#include <Inet.au3> #include <String.au3> $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe", "") If @error Then Exit $sChromeVersion = FileGetVersion($sPath) ConsoleWrite("Chrome version - " & $sChromeVersion & @CRLF) $iPID = Run(@ScriptDir & "\chromedriver.exe --version", @ScriptDir, @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($iPID) $sOutput = StdoutRead($iPID) $aResult = _StringBetween($sOutput, "ChromeDriver ", " (") $sChromeDriver = @error ? "" : $aResult[0] ConsoleWrite("Chromedriver version -- " & $sChromeDriver & @CRLF) $sChromeVersionShort = StringLeft($sChromeVersion, StringInStr($sChromeVersion, ".", 0, -1) - 1) $sChromeDriverLatest = _INetGetSource("https://chromedriver.storage.googleapis.com/LATEST_RELEASE_" & $sChromeVersionShort) ConsoleWrite("Chromedriver latest -- " & $sChromeDriverLatest & @CRLF) If $sChromeDriver = $sChromeDriverLatest Then ConsoleWrite("ChromeDriver upgrade not needed!" & @CRLF) Exit EndIf FileMove(@ScriptDir & "\chromedriver_win32.zip", @ScriptDir & "\chromedriver_win32_old.zip", $FC_OVERWRITE) $sZipFile = @ScriptDir & "\chromedriver_win32.zip" $iSize = InetGet("https://chromedriver.storage.googleapis.com/" & $sChromeDriverLatest & "/chromedriver_win32.zip", $sZipFile, $INET_FORCERELOAD, $INET_DOWNLOADWAIT) ;https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_win32.zip If $iSize > 0 Then FileMove(@ScriptDir & "\chromedriver.exe", @ScriptDir & "\chromedriver_old.exe", $FC_OVERWRITE) $sDriverPath = @ScriptDir $oShell = ObjCreate ("Shell.Application") $FilesInZip = $oShell.NameSpace($sZipFile).items $oShell.NameSpace($sDriverPath).CopyHere($FilesInZip,0x4) ConsoleWrite("Chromedriver version " & $sChromeDriverLatest & " was installed" & @CRLF) Else FileMove(@ScriptDir & "\chromedriver_win32_old.zip", @ScriptDir & "\chromedriver_win32.zip", $FC_OVERWRITE) ConsoleWrite("Download of chromedriver zip file failed" & @CRLF) EndIf  Edited November 17, 2019 by CYCho zPlayer - A Small Audio and Video Player   Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
BuiTuanAnh Posted November 22, 2019 Share Posted November 22, 2019 Hi all how do i get the image link Thanks Link to comment Share on other sites More sharing options...
Danp2 Posted November 22, 2019 Author Share Posted November 22, 2019 @BuiTuanAnh What have you tried? Show us your code. Also, please explain what you are trying to accomplish because it's no clear if you want the image's source or the destination of a link associated with the image. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
BuiTuanAnh Posted November 23, 2019 Share Posted November 23, 2019 @Danp2Â I want to right click on the image and copy the image url Link to comment Share on other sites More sharing options...
Danp2 Posted November 23, 2019 Author Share Posted November 23, 2019 @BuiTuanAnh Not sure why you would be doing it that way. Why not find the desired image element and then retrieve it's source value? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
ngocthang26 Posted November 24, 2019 Share Posted November 24, 2019 (edited) On 9/22/2018 at 10:52 PM, Danp2 said: @ngocthang26 Have you tried it like this? Note that the proxy definition is outside of chromeOptions. $sDesiredCapabilities = '{"capabilities":{"chromeOptions": {"w3c": "true"},"browserName": "chrome", "args": ["disable-web-security"], "proxy": {"proxyType":"manual","httpProxy":"10.179.70.127:10801","sslProxy":"10.179.70.127:10801","autodetect": "false"}}}' Also, is that your actual IP address for the proxy or just something you pulled off the internet? Hi Danp 2, thanks you reply Edited November 25, 2019 by ngocthang26 Thanks GreeNerO 1 Link to comment Share on other sites More sharing options...
loulou2522 Posted November 26, 2019 Share Posted November 26, 2019 Hi Damp I don't arrive to acccess this UI dialog to click on "Supprimer" Can you help me THanks Link to comment Share on other sites More sharing options...
Recommended Posts