NSearch Posted March 11, 2021 Share Posted March 11, 2021 @Nine Thank you very much for the reply.....I didn't know how to send ArrowLeft to the calendar, but I tried something similar. Thank you for showing me this. I just tried a modified version of your code, by trying again to just use ArrowLeft, but I realized that it will not work because when you go back a month it will display the previous month days again. Very frustrating....and you probably tried this yourself, which is why you are using multiple action statements. I am wondering if it is possible to read the calendar values in a loop so that you arrowleft until shipate equals the read calendar value? Link to comment Share on other sites More sharing options...
Nine Posted March 11, 2021 Share Posted March 11, 2021 I removed my post because it was inaccurate to say it was working. Now I am looking at using the arrow button to return back to the right month then select the right day. Something like this may work better : Local $sTargetDate = "2020/12/20" Local $sToday = _NowCalcDate() Local $iDateDiff = _DateDiff("M", StringTrimRight($sTargetDate, 2) & StringRight($sToday, 2), $sToday) For $i = 1 to $iDateDiff $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//a[@id="calprev"]') _WD_ElementAction($sSession, $sElement, 'click') Sleep(800) Next $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//a[@href="#' & Int(StringRight($sTargetDate,2)) & '"]', "", True) untested NSearch 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
NSearch Posted March 11, 2021 Share Posted March 11, 2021 @Nine Thank you very much -- I made a few changes and it works! Local $sTargetDate = "2020/09/02" Local $sToday = _NowCalcDate() Local $iDateDiff = _DateDiff("M", StringTrimRight($sTargetDate, 2) & StringRight($sToday, 2), $sToday) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath,'//*[@id="shipDateInput"]') _WD_ElementAction($sSession, $sElement, 'click') For $i = 1 to $iDateDiff $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//a[@id="calprev"]') _WD_ElementAction($sSession, $sElement, 'click') Sleep(800) Next $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//a[@href="#' & Int(StringRight($sTargetDate,2)) & '"]') _WD_ElementAction($sSession, $sElement, 'click') I mentioned this before in a previous post, but for those that really make a difference and go out of their way to help, like @Nine and @Danp2, please setup a https://www.buymeacoffee.com/ and put it in your signature block. Very much appreciated Link to comment Share on other sites More sharing options...
Nine Posted March 11, 2021 Share Posted March 11, 2021 (edited) @NSearch Be careful now. It may happen that there is 2 days with the same number in the month because it is showing part of the previous and part of the next months. This is why I wanted to have an array. Here my finalized script : Local $sTargetDate = "2020/12/20" Local $sToday = _NowCalcDate() Local $iDateDiff = _DateDiff("M", StringTrimRight($sTargetDate, 2) & StringRight($sToday, 2), $sToday) For $i = 1 to $iDateDiff $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//a[@id="calprev"]') _WD_ElementAction($sSession, $sElement, 'click') Sleep(800) Next Local $aElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//a[@href="#' & Int(StringRight($sTargetDate,2)) & '"]', "", True) $sElement = (UBound($aElement) = 1 Or Int(StringRight($sTargetDate,2)) <= 15) ? $aElement[0] : $aElement[1] ConsoleWrite ("Date elem " & $sElement & @CRLF) _WD_ElementAction($sSession, $sElement, 'click') Please donate to this site instead of me. Thanks. Edited March 11, 2021 by Nine Danp2 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
nooneclose Posted March 17, 2021 Share Posted March 17, 2021 @Danp2 Long time no see. (I have not had a lot of questions for many months. I am getting better at programming in Autoit) Quick question, is there a function in webdriver that checks the user's current version of chrome? (I want to be able to inform users if their chrome driver is outdated by having Autoit check for them, aka chrome, updated and the driver no longer works) If there is not, do you know of any way to perform this action using Autoit? As always, thank you for your input and time. Link to comment Share on other sites More sharing options...
Danp2 Posted March 17, 2021 Author Share Posted March 17, 2021 @nooneclose There are a couple of options that may address your need -- _WD_UpdateDriver can be used to download the correct version of the webdriver for the desired browser The next release will contain _WD_GetSession, which for now will return the contents of $_WD_SESSION_DETAILS (captured in _WD_CreateSession). This function will eventually be modified to retrieve live session details once the W3C specs support this feature. nooneclose 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted March 17, 2021 Share Posted March 17, 2021 Meanwhile you can use this : #include <InetConstants.au3> Local $dData = InetRead("https://www.whatismybrowser.com/guides/the-latest-version/chrome", $INET_FORCERELOAD) Local $sText = BinaryToString($dData) Local $sPattern = '(?s)<table class="table table-striped table-hover">.*?Windows[^\d]*([^<]*)' Local $sLatestVersion = StringRegExp($sText, $sPattern, 1)[0] ConsoleWrite ("Latest = " & $sLatestVersion & @CRLF) Local $sCurrentVersion = RegRead("HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon", "version") ConsoleWrite ("Current = " & $sCurrentVersion & @CRLF) nooneclose 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
seadoggie01 Posted March 17, 2021 Share Posted March 17, 2021 I'm looking for a way to select multiple rows in a table to be able to download a zip file. When I do this manually, I click the first element and shift+click the last element. Before I go down a hairy path, is the best way to accomplish this though building an element action? The following works, but downloads the files individually instead, which takes much longer as Edge has to scan each for viruses Spoiler ; [Bunch of setup, searching, etc] _WD_FrameEnter($sSession, $sMainFrame) ; Find the (hidden) download button on the contextmenu Local $sDownload = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='menuItem4']") ; Get the rows of the file table Local $asTableRows = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//tbody[@id='tbody']/tr", Default, True) For $i=0 To UBound($asTableRows) - 1 ; Right click the row _WD_ElementActionEx($sSession, $asTableRows[$i], "rightclick") ; Wait for the context menu to be visible If Not _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='menuItem4']", Default, Default, True, True) Then Return SetError(1, @error, False) ; Click download _WD_ElementAction($sSession, $sDownload, "click") Next All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Danp2 Posted March 17, 2021 Author Share Posted March 17, 2021 @seadoggie01 I haven't tried it, but you may be able to do a shift-click using _WD_Action. Give it a shot. If it works, we can add it as an option to _WD_ElementActionEx Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
seadoggie01 Posted March 17, 2021 Share Posted March 17, 2021 Do you have anywhere to look besides w3's website? I was really hoping to find examples somewhere on some actions (that aren't based on Selenium, ugh). The ones in the UDF are helpful, but there aren't any with key pressing. I'd be more than happy to share my code if/when I get it working All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Danp2 Posted March 17, 2021 Author Share Posted March 17, 2021 You can find some examples on the forum if you search on the terms keyUp and value. seadoggie01 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jelly Posted March 18, 2021 Share Posted March 18, 2021 I need to get span class in this my picture for click this check box. Please tell me for correct scripts. I have try to use scripts in this below but it's not working. $cName= _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[contains(text(),'001 - BEAUTY')]") _WD_ElementAction($sSession, $cName, 'click') $cNameClick=_WD_WaitElement($sSession,$_WD_LOCATOR_ByXPath,"//*[@class='rtPlus']") _WD_ElementAction($sSession, $cNameClick, 'click') Link to comment Share on other sites More sharing options...
Danp2 Posted March 18, 2021 Author Share Posted March 18, 2021 @jelly By default, _WD_WaitElement doesn't return the found element. You will need to change your code to this -- $cNameClick=_WD_WaitElement($sSession,$_WD_LOCATOR_ByXPath,"//*[@class='rtPlus']", Default, Default, Default, Default, True) You didn't provide enough information to know if the above is all that's required to make your script function. If you need further help, then please post additional details, such as -- website involved Results from Scite output panel Etc Regards, Dan P.S. Welcome to the forum jelly 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
seadoggie01 Posted March 18, 2021 Share Posted March 18, 2021 Coming back to say, shift-clicking is way easier than I expected. It doesn't seem to be possible to submit a single action that does it all (press shift, move the mouse, click, and release shift), but I'm bad with JSON, so it may be incorrectly formatted. This is what I came up with: Func _WDEx_ElementShiftClick($sSession, $sElement) ; Hold shift down Local $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE008"}]}]}' _WD_Action($sSession, "actions", $sAction) If @error Then Return SetError(1, 0, False) ; Easy click? _WD_ElementAction($sSession, $sElement, "click") If @error Then Return SetError(2, 0, False) ; Release shift $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyUp", "value": "\uE008"}]}]}' _WD_Action($sSession, "actions", $sAction) If @error Then Return SetError(3, 0, False) ;~ ; 4 actions together? Not that I can tell... ;~ $sAction = '{"actions":[{"type":"key","id":"keyboard_1","actions":[{"type":"keyDown","value":"\uE008"}]},' ;~ $sAction &= '{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove",' ;~ $sAction &= '"origin":{"ELEMENT":"' & $sElement & '","' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}},' ;~ $sAction &= '{"button":0,"type":"pointerDown"},{"button":0,"type":"pointerUp"}]},{"type":"key","id":"keyboard_1","actions":[{"type":"keyUp","value":"\uE008"}]}]}' ;~ $sAction &= ']}]}' ;~ _WD_Action($sSession, "actions", $sAction) Return True EndFunc All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Danp2 Posted March 18, 2021 Author Share Posted March 18, 2021 (edited) @seadoggie01 I believe this could be done with a single call to _WD_Action. Untested, but I believe it would look something like this -- ; Hold shift down Local $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE008"}]}],' ; Move mouse to element $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 & '"}},' ; Perform click $sAction &= '{"button":2,"type":"pointerDown"},{"button":2,"type":"pointerUp"}]}],' ; Release shift $sAction &= '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyUp", "value": "\uE008"}]}]}' _WD_Action($sSession, "actions", $sAction) I may not have the exact formatting, but you should get the gist of it. Edit: Here's the corrected code, which I have tested -- $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE008"}]},' ; Move mouse to element $sAction &= '{"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 & '"}},' ; Perform click $sAction &= '{"button":0,"type":"pointerDown"},{"button":0,"type":"pointerUp"}]},' ; Release shift $sAction &= '{"type": "key", "id": "keyboard_2", "actions": [{"type": "keyUp", "value": "\uE008"}]}]}' _WD_Action($sSession, "actions", $sAction) I'll see if this can be easily added to _WD_ElementActionEx. It would be nice to have a single directive like "modifierClick' that could be used to perform shift|control|alt clicks. Edited March 18, 2021 by Danp2 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Letraindusoir Posted March 19, 2021 Share Posted March 19, 2021 (edited) Want to use IE11 browser + webdriver, see the help reference, requirements: Quote IEDriverServer version number and Selenium version number must be consistent.... I have a question: where to look at the current selenium version? In other words: how to choose the matching 'IEDriverServer' version number that matches 'IE11 browser'? More thanks! Edited March 19, 2021 by Letraindusoir Link to comment Share on other sites More sharing options...
Danp2 Posted March 19, 2021 Author Share Posted March 19, 2021 @Letraindusoir Since you're asking the question here, then I'm assuming that you want to do this with AutoIt, not Selenium. Therefore, I believe the quote above doesn't apply. Are you having issues with IEDriverServer? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Letraindusoir Posted March 19, 2021 Share Posted March 19, 2021 (edited) 3 hours ago, Danp2 said: @Letraindusoir Since you're asking the question here, then I'm assuming that you want to do this with AutoIt, not Selenium. Therefore, I believe the quote above doesn't apply. Are you having issues with IEDriverServer? Recently want to use IEDriverServer + IE11 to operate the web page, feel very bad, there are various problems, initially thought that did not find the right IEDriverServer version. Few people use IE11 now, and there are few examples in the forum... Edited March 19, 2021 by Letraindusoir Link to comment Share on other sites More sharing options...
Chuckero Posted March 22, 2021 Share Posted March 22, 2021 How to check the version of chromedriver.exe? The Chrome browser updates very often and chromedriver.exe is not compatible with different versions, so I'm trying to create some auto-update script. So, before run all the system I'm doing a kind of check list and verifying all the software version. I already getting the version from Chrome, but there is no information embedded in the chromedriver.exe, is there a way to check it? Or another idea about this update script? Link to comment Share on other sites More sharing options...
Nine Posted March 22, 2021 Share Posted March 22, 2021 Not sure how long it is going to work. You may need to adapt it to new (or old) version. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts