Jump to content

Search the Community

Showing results for tags 'webdriver'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

  1. Today I hit such kind of problem: I saw: https://stackoverflow.com/questions/77055938/error-during-registration-remoteerrorchrome-remote-content-shared-remoteerro and: https://github.com/mozilla/geckodriver/issues/2204 https://bugzilla.mozilla.org/show_bug.cgi?id=1925934 https://docs.testery.io/fixing-tests/fix-common-selenium-exceptions/fix-an-unhandledalertexception I update FireFox to 133Beta and now I have such results: Dialog text: Masz nowe wiadomości. W celu ich przeczytania naciśnij przycisk "Komunikator". Po przeczytaniu oznacz wiadomość jako przeczytaną! GOOGLE TRANSLATE: Dialog text: You have new messages. To read them, press the "Communicator" button. After reading, mark the message as read! My question is how to bypass this problem with AutoIt ? I mean how to catch up such dialog exist ?
  2. Introduction This UDF will allow you to interact with any browser that supports the W3C WebDriver specifications. Supporting multiple browsers via the same code base is now possible with just a few configuration settings. Requirements JSON UDF https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn WinHTTP UDF https://www.autoitscript.com/forum/topic/84133-winhttp-functions/ WebDriver for desired browser Source Code You will always be able to find the latest version in the GitHub Repo Help / Support See the wiki for details on the UDF -- https://www.autoitscript.com/wiki/WebDriver Please post any questions, suggestions or errors in a new thread in the GH&S section. Previous support threads (Closed) https://www.autoitscript.com/forum/topic/192730-webdriver-udf-help-support/ https://www.autoitscript.com/forum/topic/201106-webdriver-udf-help-support-ii/ https://www.autoitscript.com/forum/topic/205553-webdriver-udf-help-support-iii/ https://www.autoitscript.com/forum/topic/208640-webdriver-udf-help-support-iv/
  3. I tried to print this web page https://aplikacja.ceidg.gov.pl/CEIDG/CEIDG.Public.UI/Search.aspx using WebDriver to A4 portrait (210x297 mm) with no success. As I'm able to do this on few other pages then I check how to FireFox save the page to PDF when I try it manually. And the issue is that I always get A3 landscape (297x420 mm) I would ask some folks to check what is wrong with this page and how I can ensure that generated PDF with manually printng give me A4 portrait (210x297 mm) instead A3 landscape (297x420 mm) I will be grateful for any help
  4. Hi, I have the below script. It should return the second screenshot, however sometimes I get the first screenshot. On some computers I almost 90% get screen 2, but on some others I get screen 1 (wrong screen) almost every time. I have played around with "_WD_LoadWait", sleep or using "_WD_WaitElement", however I do not seem to be able get the reason why my script is behaving so randomly. Does anyone have some insights for me ? #include "wd_helper.au3" #include "wd_capabilities.au3" _Example() Func _Example() # REMARK # This is not functional script # It only shows the concept how to use WebDriver UDF #Region ; initialize webdriver sesion _WD_UpdateDriver('chrome') ; specify driver, port and other options _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & @ScriptDir & '\chrome.log"') ; start the driver _WD_Startup() If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; create capabilites for session _WD_CapabilitiesStartup() _WD_CapabilitiesAdd('alwaysMatch', 'chrome') _WD_CapabilitiesAdd('w3c', True) _WD_CapabilitiesAdd('excludeSwitches', 'enable-automation') Local $sCapabilities = _WD_CapabilitiesGet() ; create session with given Capabilities Global $sSession = _WD_CreateSession($sCapabilities) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's _WD_Window($sSession, 'maximize') #EndRegion ; initialize webdriver sesion #Region ; do your's stuff ; navigate to some website Local $sURL = "https://ordermanager.tecalliance.net/newapp/auth/login" _WD_Navigate($sSession, $sURL) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; wait for loading process ends _WD_LoadWait($sSession, 1000) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; find cookie popup Local $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='mat-button-wrapper']") If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; click on default button from cookie popup (accept) _WD_ElementAction($sSession, $sElement, 'click') If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; wait max. 50 seconds for the login button (=aanmelden) to be available _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='mat-focus-indicator log-in-button mat-raised-button mat-button-base']", 100, 50 * 1000) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; find this login (=aanmelden) button $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='mat-focus-indicator log-in-button mat-raised-button mat-button-base']") If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; click this "login" button to start login process _WD_ElementAction($sSession, $sElement, 'click') If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; wait for the username (=gebruikersnaam) field to be available _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//input[@id="input28"]', 100, 30 * 1000) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; find this username field $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//input[@id="input28"]') If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; fill in user e-mail in the input field _WD_ElementAction($sSession, $sElement, 'value', "test@test.nl") If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; lookup orange [Volgende] (=next) button $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='button button-primary']") If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; click on the orange [volgende] (=next) button to continue _WD_ElementAction($sSession, $sElement, 'click') If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's Exit ; Exit so not to close his Chrome session. #EndRegion ; do your's stuff #Region ; Clean Up ; on the end session should be deleted _WD_DeleteSession($sSession) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; and driver should be closed _WD_Shutdown() If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's #EndRegion ; Clean Up EndFunc ;==>_Example
  5. Today my Firefox scripts started returning HTTP method not allowed: _WD_IsLatestRelease ==> Success (0) : False _WD_Startup: OS: WIN_10 WIN32_NT 19045 _WD_Startup: AutoIt: 3.3.14.5 _WD_Startup: Webdriver UDF: 0.8.1 (Update available) _WD_Startup: WinHTTP: 1.6.4.2 _WD_Startup: Driver: C:\Users\joeur\Documents\AutoIt_code/geckodriver.exe (32 Bit) _WD_Startup: Params: _WD_Startup: Port: 4444 _WD_Startup: Command: "C:\Users\joeur\Documents\AutoIt_code/geckodriver.exe" __WD_Post: URL=HTTP://127.0.0.1:4444/session; $sData={"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}} __WD_Post ==> Invalid argument (5) HTTP status = 400 : ResponseText={"value":{"error":"invalid argument","message":"missing field `capabilities`","stacktrace":""}}... _WD_CreateSession: {"value":{"error":"invalid argument","message":"missing field `capabilities`","stacktrace":""}} _WD_CreateSession ==> Webdriver Exception (10) HTTP status = 400 __WD_Post: URL=HTTP://127.0.0.1:4444/session//url; $sData={"url":"https://www.catribunal.org.uk"} __WD_Post ==> Unknown Command (16) HTTP status = 405 : ResponseText=HTTP method not allowed... _WD_Navigate ==> Unknown Command (16) HTTP status = 405 : HTTP method not allowed __WD_Post: URL=HTTP://127.0.0.1:4444/session//window/maximize; $sData={} __WD_Post ==> Unknown Command (16) HTTP status = 405 : ResponseText=HTTP method not allowed... _WD_Window ==> Unknown Command (16) HTTP status = 405 : : Response=HTTP method not allowed... __WD_Post: URL=HTTP://127.0.0.1:4444/session//elements; $sData={"using":"xpath","value":"//table[@id='table%20alfresco-table']/tbody/tr"} __WD_Post ==> Unknown Command (16) HTTP status = 405 : ResponseText=HTTP method not allowed... _WD_FindElement ==> Unknown Command (16) HTTP status = 405 : HTTP method not allowed _WD_GetTable ==> Unknown Command (16) HTTP status = 405 __WD_Post: URL=HTTP://127.0.0.1:4444/session//element; $sData={"using":"xpath","value":"//a[@id='table%20alfresco-table'][not(@disabled)]"} __WD_Post ==> Unknown Command (16) HTTP status = 405 : ResponseText=HTTP method not allowed... _WD_FindElement ==> Unknown Command (16) HTTP status = 405 : HTTP method not allowed __WD_Delete: URL=HTTP://127.0.0.1:4444/session/ __WD_Delete ==> Unknown Command (16) HTTP status = 405 : ResponseText=HTTP method not allowed... _WD_DeleteSession ==> Webdriver Exception (10) HTTP status = 405 : HTTP method not allowed I've updated both Webdriver UDF and geckodriver.exe #include "wd_helper.au3" #include "wd_helper.au3" #include "wd_core.au3" #include <Array.au3> #include <Date.au3> Global $_WD_DRIVER, $_WD_READYSTATE_Interactive Local $sDesiredCapabilities $resources = @MyDocumentsDir & '\AutoIt_code\getter\resources\' SetupGecko() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, 'https://www.catribunal.org.uk') ;$Handle = _WD_Window($sSession, 'window', '') _WD_Window($sSession, "Maximize") Local $aResult = _WD_GetTable($sSession, "//table[@id='table%20alfresco-table']") $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@id='table%20alfresco-table'][not(@disabled)]") _ArrayDisplay($aResult) Sleep(5000) _WD_DeleteSession($sSession) _WD_Shutdown() Func SetupGecko() _WD_Option('Driver', @ScriptDir & '/geckodriver.exe') ;_WDOption('DriverParams', '--log trace') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' ;$sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true, {"browserOptions": --binary C:\Program Files (x86)\Mozilla Firefox\firefox.exe, "browserName": firefox, "browserVersion": 59.0.1}}}' EndFunc ;==>SetupGecko
  6. I have several webdriver "projects" using the Webdriver UDF. For these I specifically use Chromedriver. Recently I noticed people getting an onetime popup when using GoogleChrome to choose their default serach engine. Yesterdy, I just installed a new WIndows 11 machine and got the popup once when using Google Chrome for the first time, however when using webdriver/chromedriver I get the popup everytime I start a script. Older computers with Wndows 10 or WIndows 11 do not have the popup when running the same scripts! Does any one know a way do disable this within my chromedriver Autoit scripts?
  7. In the old FF.au3 library, there were two functions for getting and setting values of about:config preferences for Firefox. I was wondering if there are any equivalents for WebDriver au3, @Danp2 Func _FFPrefGet($sName) Local Const $sFuncName = "_FFPrefGet" Local $sCommand Local $iType = _FFCmd('FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); FFau3.obj.getPrefType("' & $sName & '");') If @error Then SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, $sName)) Return 0 EndIf Switch $iType Case 0 SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$sName: " & $sName)) Return 0 Case 32 ; PREF_STRING $sCommand = "getCharPref" Case 64 ; PREF_INT $sCommand = "getIntPref" Case 128 ; PREF_BOOL $sCommand = "getBoolPref" EndSwitch $sCommand = StringFormat('FFau3.obj.%s("%s");', $sCommand, $sName) Return _FFCmd($sCommand) EndFunc ;==>_FFPrefGet Func _FFPrefSet($sName, $vValue) Local Const $sFuncName = "_FFPrefSet" Local $sCommand Local $iType = _FFCmd('FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);FFau3.obj.getPrefType("' & $sName & '");') If @error Then SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, $sName)) Return 0 EndIf Local $vOldValue = _FFPrefGet($sName) Switch $iType Case 0 SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$sName: " & $sName)) Return 0 Case 32 ; PREF_STRING If Not IsString($vValue) Then SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(string) $vValue: " & $vValue)) Return 0 EndIf $sCommand = StringFormat('FFau3.obj.%s("%s","%s");', "setCharPref", $sName, $vValue) Case 64 ; PREF_INT If Not IsInt($vValue) Then SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $vValue: " & $vValue)) Return 0 EndIf $sCommand = StringFormat('FFau3.obj.%s("%s",%s);', "setIntPref", $sName, $vValue) Case 128 ; PREF_BOOL If Not IsBool($vValue) Then SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(bool) $vValue: " & $vValue)) Return 0 EndIf $sCommand = StringFormat('FFau3.obj.%s("%s",%s);', "setBoolPref", $sName, __FFB2S($vValue)) EndSwitch _FFCmd($sCommand) If Not @error Then Local $vRetVal = _FFPrefGet($sName) If Not @error And $vRetVal = $vValue Then SetExtended($vOldValue) Return 1 Else SetError(__FFError($sFuncName, $_FF_ERROR_RetValue, "$vValue <> " & $vRetVal)) Return 0 EndIf EndIf Return 0 EndFunc ;==>_FFPrefSet
  8. Hi folks 👋 , I am really curious about which browsers/drivers are automated or tested by you guys on a regular base. Analyzing the answers can be helpful for the future of the project au3WebDriver. #browsersupport So please consider taking part. Thank you 🤝 . Best regards Sven
  9. The WebDriver UDF provides a toolbox full of functions to facilitate automating Web browsers. Still scripts can become quite complex. In this thread users can post "real life" examples to show how specific tasks can be implemented. Note When posting an example please describe the purpose of the script and the WebDriver functionality used!
  10. Today I found this: https://github.com/gildas-lormeau/SingleFile/discussions/1226 I tried to use this with GoogleChrome https://chrome.google.com/webstore/detail/singlefile/mpiodijhokgodhhofbcjdecpffjipkle I found some solution here: https://stackoverflow.com/a/75376708/5314940 And I'm trying to do it this way: function send(extensionId, msg, callback, retry = 20) { const timer = setTimeout(send, 100, extensionId, msg, callback, retry - 1); chrome.runtime.sendMessage(extensionId, msg, response => { if (!chrome.runtime.lastError || !retry) { clearTimeout(timer); callback(response); } }); }; send('{531906d3-e22f-4a6c-a102-8057b88a1a63}', '{ action: "save-page" }'); But errors occurs. Any help with how to use it with JS ? EIDT: After finding a way I provide example in AutoIt
  11. Hello, I open a new thread here since i dont want to hijack the thread of @water called "I'm creating a WebDriver tutorial". As recommended i started to take a deeper look into the "GDPR fines.au3" example. I also fount that "au3WebDriver-0.11.0" comes with a nice Help file "Webdriver.chm" When running GDPR fines.au3 i noticed that it uses a function called: _WD_GetTable($sSession, $sBaseElement, $iPage) It has 3 function parameters and is IN the "GDPR fines.au3" So i got an error: wrong number of args. Further investigation showed me that this function is already defined in the "wd_helper.au3" which is loaded at the beginnings #include but has only 2 parameters. So i commented out the function in the "wd_helper.au3" The _WD_GetTable function ran error free now but the next stop was: _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='penalties_length']//option[contains(text(),'" & $aOptions[UBound($aOptions, 1) - 2] & "')]") Variable subscript badly formatted (Error at -> UBound) I'm not really sure why this happens because i dont really know how to traverse a website yet. Have to dig deeper and read into it more.
  12. Hello, I was wanting to use the 'wd_core.au3' and 'wd_helper.au3' libraries to locate a checkbox and do an action if it is checked or not (if not checked, check it and if it is unchecked) This is my script: $sStrategy = $_WD_LOCATOR_ByXPath $5Selector = "/html/body/div[2]/div[2]/div[2]/div/div/form/div[1]/div[2]/div[1]/input[1]" $sStartNodeID = Default $bMultiple = False $bShadowRoot = Default $sCheckboxID = _WD_FindElement($oSession, $sStrategy, $5Selector, $sStartNodeID, $bMultiple, $bShadowRoot) $sCoordinates = _WD_ElementAction($oSession, $sCheckboxID, 'property', 'rect') Local $sResponse = __WD_Get("exemple.com" & $sCheckboxID & "/" & 'property' & "/" & 'rect') Local $aResult = StringRegExp($sResponse, '"rect":({.*?})', 1) If IsArray($aResult) Then Local $sCoordinates = $aResult[0] ; Processar a string $sCoordinates para extrair as coordenadas ConsoleWrite("Coordinates is: " & $sCoordinates & @CRLF) EndIf But autoit only finds the element but gives an error: _WD_ElementAction ==> Success [0] : Parameters: Command=property Option=rect __WD_Get ==> Invalid value [4] : HTTP status = 0 Note: I use chrome version "113.0.5672.93 (Official Version) 64bit", and the driver is suitable for this version.
  13. Internet Explorer is nearly dead, newer versions of Firefox can't any longer be automated using Stilgar's FF UDF. Hence more and more users (including me) need to look at automating Webbrowsers using WebDriver. That's why I have started to create a tutorial in the wiki. It should describe all necessary steps from intallation to usage. I'm still collecting ideas for the tutorial - that's where you come into play. What do you expect to see in such a tutorial? Which browsers should be covered (Firefox, Chrome and Edge are settled)? Any questions for the FAQ? Which (high level) coding examples do you expect (like "How to attach to a running browser instance") ... Like to see your comments ToDo-List: Add "Tools" section and add ChroPath plugin. Done. FAQ: "How to attach to a running browser instance". Done. Explain the difference between iuiautomation, iaccessible, autoit, webdriver. Done. The AutoIt FAQ 40 has been extended. Detailed description of each function. Done Example for "how to deal with downloading". Use function _WD_DownloadFile. Example for "how to deal with popups (alerts, print or save dialog). Use function_WD_AlertRespond to respond to a user prompt. Example for "how to deal with multiple tabs". Use functions _WD_NewTab (create a new tab), _WD_Window (close or switch to a tab) and _WD_Attach (attach to existing tab).
  14. Hello! I've been trying to launch chrome through WD, but for some reason, the user profile is not working, it just opens up the chrome window with the "temp" user. I've also made sure that the user profile path is correct by using "chrome://version". Here is what I've got so far: #include "wd_helper.au3" #include "wd_capabilities.au3" #include "wd_core.au3" SetupChrome() _WD_CapabilitiesStartup() Local $sCapabilities = _WD_CapabilitiesGet() $sSession = _WD_CreateSession($sCapabilities) _WD_Navigate($sSession, "https://www.google.com") Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"') _WD_Option('DriverParams', '--marionette-port 2828') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\", "--profile-directory=Profile 2"]}}}}' $_WD_DEBUG = $_WD_DEBUG_None ; You could also use $_WD_DEBUG_Error EndFunc Thanks in advance!
  15. Good morning, everyone, I have had very good luck with using _WD_ElementActionEx 'CLICKANDHOLD'. What would be the best practice with dragging and dropping web elements? I would prefer to not to have to use any dragging and dropping but I haven't figured out a way to change the order the elements are displayed programmatically. I have a list of elements that are drag and drop. These elements in code are using <UL></UL> for the entire list and the actual web elements that are being manipulated are in <LI></LI> tags. These do not look like a bulleted list but that is the code that is being used. I've spoken with the web developer and there isn't any hot keys or keyboard commands that can be used to move these elements. I know where the new and original web element appears and can select them using the _WD_WaitElement and _WD_FindElement combo. I can find the number of items in the list by looking at the code; I haven't started pulling the values out just yet. I am trying to figure out if there is a place to change the listed order. Using the 'CLICKANDHOLD' feature as part of _WD_ElementActionEx does work and I know more or less where I need to drop it the new web element; the problem I am having is scrolling exactly to where I need the new web element dropped. It should be dropped beneath the original web element. What's the best method to output the number of children associated with the <UL></UL>? I am guessing that _WD_ElementActionEx 'CHILDCOUNT' would be it; but I haven't figured out how to get the call to output in a msgbox or in the console. #cs ---------------------------------------------------------------- Name ..........: Please Note!.au3 Description ...: To be used to add new lessons to existing playlists and to update the pre-existing lesson with the Please Note! PowerPoint SciTE 32-bit ..: Version 4.4.6 Author(s) .....: Thomas E. Bennett Date ..........: 20220929 Recommended Reading / Requirements https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-01162021/#comments https://www.autoitscript.com/wiki/WebDriver https://www.autoitscript.com/wiki/WebDriver#Installation https://www.autoitscript.com/wiki/Adding_UDFs_to_AutoIt_and_SciTE https://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine wd_core.au3 wd_helper.au3 From wd_core.au3 Global Const $_WD_LOCATOR_ByCSSSelector = "css selector" Global Const $_WD_LOCATOR_ByXPath = "xpath" Global Const $_WD_LOCATOR_ByLinkText = "link text" Global Const $_WD_LOCATOR_ByPartialLinkText = "partial link text" Global Const $_WD_LOCATOR_ByTagName = "tag name" #ce ---------------------------------------------------------------- #include "wd_core.au3" #include "wd_helper.au3" #include <MsgBoxConstants.au3> #include <Excel.au3> #include <AutoItConstants.au3> Local $sDesiredCapabilities, $sSession, $sElement ; Create application object and open an example workbook Local $oExcel = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\{PRIVACY}.xlsx") If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error opening workbook '" & @ScriptDir & "\{PRIVACY}.xlsx'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf ; Read data from a single cell on the active sheet of the specified workbook ;Local $sResult = _Excel_RangeRead($oWorkbook, Default, "A1") ;If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 1", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ;MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 1", "Data successfully read." & @CRLF & "Value of cell A1: " & $sResult) SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) Sleep (15000) Local $aResult = _Excel_RangeRead($oWorkbook, Default, "A16:E16") For $i = 0 To UBound($aResult, 1) - 1 ;ConsoleWrite("========= Start Row =========" & @CRLF) ;ConsoleWrite($aResult[$i][0] & @CRLF) ; Column A -- Course Playlist Number ;ConsoleWrite($aResult[$i][1] & @CRLF) ; Column B -- Course Playlist Title ;ConsoleWrite($aResult[$i][2] & @CRLF) ; Column C -- Original Lesson Title ;ConsoleWrite($aResult[$i][3] & @CRLF) ; Column D -- Updated Lesson Number ;ConsoleWrite($aResult[$i][4] & @CRLF) ; Column E -- Updated Lesson Title ;ConsoleWrite("========= End Row =========" & @CRLF & @CRLF) _WD_Navigate($sSession, "{PRIVACY}" & $aResult[$i][0]) _WD_LoadWait($sSession, 2000) ; Find the Available Lessons search box and enter the appropriate value _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='titleSearch']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='titleSearch']") ; Click the Sign in button _WD_ElementAction($sSession, $sElement, 'value', $aResult[$i][3]) Send("{Enter}") ; Find the correct "Add" hyperlink _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//span[text()='" & $aResult[$i][4] & "']/following-sibling::div") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[text()='" & $aResult[$i][4] & "']/following-sibling::div") ; Click the "Add" hyperlink _WD_ElementAction($sSession, $sElement, 'click') ; Number of Child Elements _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']") _WD_ElementActionEx($sSession, $sElement, 'CHILDCOUNT') Exit ; Click and Hold the appropriate element _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']//span[@class='item-description' and text()='" & $aResult[$i][4] & "']/parent::li") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']//span[@class='item-description' and text()='" & $aResult[$i][4] & "']/parent::li") _WD_ElementActionEx($sSession, $sElement, 'clickandhold', 0, 0, 0, 10000) ; Hover the appropriate element _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']//span[@class='item-description' and text()='" & $aResult[$i][4] & "']/following-sibling::a") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//ul[@id='selected-items']//span[@class='item-description' and text()='" & $aResult[$i][4] & "']/following-sibling::a") _WD_ElementActionEx($sSession, $sElement, 'HOVER') Exit Next Exit _WD_DeleteSession($sSession) _WD_Shutdown() Exit Func SetupChrome() ; Google Chrome _WD_Option('Driver', "C:\Users\thomas.bennett\Desktop\AutoIt\include\chromedriver.exe") _WD_Option('Port', 9515) ;_WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", ' & _ '"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, ' & _ '"prefs": {"credentials_enable_service": false},' & _ '"args": ["start-maximized"] }}}}' EndFunc Console Output >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\thomas.bennett\Desktop\AutoIt\Please Note!\Please Note!.au3" /UserParams +>09:22:40 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0) Keyboard:00000409 OS:WIN_10/2009 CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\thomas.bennett\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\thomas.bennett\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\thomas.bennett\Desktop\AutoIt\Please Note!\Please Note!.au3 +>09:22:40 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\thomas.bennett\Desktop\AutoIt\Please Note!\Please Note!.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. _WD_Option ==> Success [0] : Parameters: Option=Driver Value=C:\Users\thomas.bennett\Desktop\AutoIt\include\chromedriver.exe _WD_Option ==> Success [0] : Parameters: Option=Port Value=9515 _WD_IsLatestRelease ==> Success [0] : True _WD_Startup: OS: WIN_10 WIN32_NT 22000 _WD_Startup: AutoIt: 3.3.14.5 _WD_Startup: Webdriver UDF: 0.10.1 (Up to date) _WD_Startup: WinHTTP: 1.6.4.2 _WD_Startup: Driver: C:\Users\thomas.bennett\Desktop\AutoIt\include\chromedriver.exe (32 Bit) _WD_Startup: Params: _WD_Startup: Port: 9515 _WD_Startup: Command: "C:\Users\thomas.bennett\Desktop\AutoIt\include\chromedriver.exe" _WD_Startup ==> Success [0] __WD_Post ==> Success [0] : HTTP status = 200 _WD_CreateSession ==> Success [0] : 2542b35e47b8f9b2558cd92ad1418811 __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL={PRIVACY} _WD_LoadWait ==> Success [0] : Parameters: Delay=2000 Timeout=Default Element=Default _WD_WaitElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='Username'] Delay=Default Timeout=Default Options=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='Username'] StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_ElementAction ==> Success [0] : Parameters: Command=value Option=<masked> _WD_WaitElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='Password'] Delay=Default Timeout=Default Options=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='Password'] StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_ElementAction ==> Success [0] : Parameters: Command=value Option=<masked> _WD_WaitElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@value='Sign In'] Delay=Default Timeout=Default Options=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@value='Sign In'] StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_ElementAction ==> Success [0] : Parameters: Command=click Option=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL={PRIVACY} _WD_LoadWait ==> Success [0] : Parameters: Delay=2000 Timeout=Default Element=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_Navigate ==> Success [0] : Parameters: URL={PRIVACY} _WD_LoadWait ==> Success [0] : Parameters: Delay=2000 Timeout=Default Element=Default _WD_WaitElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='titleSearch'] Delay=Default Timeout=Default Options=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//input[@id='titleSearch'] StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_ElementAction ==> Success [0] : Parameters: Command=value Option=<masked> _WD_WaitElement ==> Timeout [7] : Parameters: Strategy=xpath Selector=//span[text()='{PRIVACY}']/following-sibling::div Delay=Default Timeout=Default Options=Default __WD_Post ==> No match [8] : HTTP status = 404 _WD_FindElement ==> No match [8] : Parameters: Strategy=xpath Selector=//span[text()='{PRIVACY}']/following-sibling::div StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> No match [8] : HTTP status = 404 _WD_ElementAction ==> No match [8] : Parameters: Command=click Option=Default _WD_WaitElement ==> Success [0] : Parameters: Strategy=xpath Selector=//ul[@id='selected-items'] Delay=Default Timeout=Default Options=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//ul[@id='selected-items'] StartNodeID=Default Multiple=Default ShadowRoot=Default __WD_Post ==> Success [0] : HTTP status = 200 _WD_ExecuteScript ==> Success [0] _WD_ElementActionEx ==> Success [0] : Parameters: Element=21c01052-8b86-4058-b8f6-d9dfa750f9ee Command=CHILDCOUNT XOffset=Default YOffset=Default Button=Default HoldDelay=Default Modifier=Default +>09:23:20 AutoIt3.exe ended.rc:0 +>09:23:20 AutoIt3Wrapper Finished. >Exit code: 0 Time: 40.88 My thought is once AutoIt knows how many child elements there are; I am hoping that there would be a way to change the sort or priority order that the <LI></LI>'s are shown in. Thank you for your time and efforts on this and as I progress I'll update this topic, Thomas
  16. I am having trouble finding a good way to click these "button" below. I only need to be able to click them when they have both yes/no. Otherwise I don't have to worry about them. For instance if they looked like this I would NOT have worry about clicking them and can just ignore them all togheter.(Below Picture) The problem is as mentioned in the title, all of the ID's are dynamic. (Classes too) Here is what it looks like if yes is already selected. This is what I was using to select the the button. However, I need to know if the button has already been clicked/selected or not. _WD_LoadWait($sSession) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[text() = 'Offered access to electronic health information?']") Sleep(1000) _WD_ElementAction($sSession, $sElement, 'click') Sleep(500) _WD_Action($sSession, "actions", $sActionTab) Sleep(500) _WD_Action($sSession, "actions", $sActionEnter) Is there a way I can get the count of spans in the span class-"s_636" by tabbing over to the button? I am hoping someone might have some ideas on what I can try. Unfortunally, The site is for work so giving the site wont do any good.
  17. #cs ---------------------------------------------------------------- Name ..........: ignore.au3 Description ...: Testing _WD_HighlightElements SciTE 32-bit ..: Version 4.4.6 Author(s) .....: Thomas E. Bennett Date ..........: 20220929 Recommended Reading / Requirements https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-01162021/#comments https://www.autoitscript.com/wiki/WebDriver https://www.autoitscript.com/wiki/WebDriver#Installation https://www.autoitscript.com/wiki/Adding_UDFs_to_AutoIt_and_SciTE https://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine wd_core.au3 wd_helper.au3 From wd_core.au3 Global Const $_WD_LOCATOR_ByCSSSelector = "css selector" Global Const $_WD_LOCATOR_ByXPath = "xpath" Global Const $_WD_LOCATOR_ByLinkText = "link text" Global Const $_WD_LOCATOR_ByPartialLinkText = "partial link text" Global Const $_WD_LOCATOR_ByTagName = "tag name" #ce ---------------------------------------------------------------- #include "wd_core.au3" #include "wd_helper.au3" #include "wd_cdp.au3" #include "wd_capabilities.au3" #include <MsgBoxConstants.au3> Local $sDesiredCapabilities, $sElement, $sSession Func SetupChrome() ; Google Chrome _WD_Option('Driver', @ScriptDir & "\include\chromedriver.exe") _WD_Option('Port', 9515) ;_WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", ' & _ '"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, ' & _ '"prefs": {"credentials_enable_service": false},' & _ '"args": ["start-maximized"] }}}}' EndFunc SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) Sleep (15000) ; DuckDuckGo _WD_Navigate($sSession, "https://duckduckgo.com/") _WD_LoadWait($sSession, 2000) ; Find the Search field _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='search_form_input_homepage']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='search_form_input_homepage']") ; Highlight the Search field _WD_HighlightElements($sSession, $sElement, 3) MsgBox(0,"","") Exit ;this is here on purpose _WD_DeleteSession($sSession) _WD_Shutdown() Exit Good evening, everyone, I am trying to get any element to highlight using the _WD_HighlightElements function; I've tried different elements and for a time I thought maybe because I am working in Windows 11 so I switched back to Windows 10 same issue; I can't get the found element to highlight. What am I doing incorrectly? Console Output _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"0e212d4f-8437-42a0-a56a-bc8694fe6e66"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/0e05f8ea99dba06bb84908b0b46fe881/element; $sData={"using":"xpath","value":"//input[@id='search_form_input_homepage']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"0e212d4f-8437-42a0-a56a-bc8694fe6e66"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"0e212d4f-8437-42a0-a56a-bc8694fe6e66"}} Thank you for your time on this, Thomas E. Bennett
  18. Good morning, everyone, I am using WebDriver with ChromeDriver version 105.0.5195.52 I have the script almost completed; this is going to be used as a wait / pause until the file has completed uploading. I was able to find where the value: "C:\\fakepath\\Vladimir Harkonnen.jpg" is stored. I am trying to figure out how to read this value. This is part of an <input type="file"> element. Reading / finding the value would be the trigger to allow the script to continue. I don't know very much but I feel like I am either not using WebDriver correctly or possibly it won't be able to help me with what I am trying to do. Please see the attached screenshot. Thank you for your time, experience, and patience with me, Thomas Bennett
  19. For the past two days I've been reading all Wiki pages, installed all the demos etc. but I am still unable to do this simple workflow 1. I want to use WebDriver UDF to open Chrome (Set chrome option arguments - Window Size, Pixel ratio, device type and platform name, user-agent.) 2. On new Tab I want to read the tab Title and save it into a TXT file. 3. I need to save the Session ID with my previosly set Capabilities into a file. 4. I want to close the chrome window. Then 5. I want to open Chrome again, but with my previosly saved Session ID and Capabilities list from the file. 6. And minimaze the window state. 7. After 30 seconds, close the chrome. I would really appreciate for the WebDriver UDF Helper file, to have also basic code examples, for non coders. For example how to open a windwow etc., save sessions, etc. Anyway, if someone could help me get started and help me with this workflow, that would be much appreaciated. 😔
  20. hi i try to use webdriver i download it and download json and winhttp i try to run it but return error error: __WinHttpVer(): undefined function. Local $sWinHttpVer = __WinHttpVer() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  21. Hi Guys, i just do some codding to automate login to some of the web. I manage to do the script but somehow after script done, some weird box popup. and keep looping until i close the main chrome.exe here is my code. kinldy pls assist, im very new to webdriver udf. #NoTrayIcon #include "wd_core.au3" #include "wd_helper.au3" $_WD_DEBUG = $_WD_DEBUG_None ; You could also use $_WD_DEBUG_Error Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://someoftheweb.com") _ChromeSetInputValueByName($sSession, "inputName", "Username") _ChromeSetInputValueById($sSession, "inputPassword", "Password") _ChromeSetMouseClick($sSession, "submit", "click") _WD_Shutdown() 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, "args":["--no-sandbox"]}}}}' EndFunc Func _ChromeSetInputValueByName($sSession,$name,$Value) $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$name&"']") _WD_ElementAction($sSession,$sButton,'value', $Value) EndFunc Func _ChromeSetInputValueById($sSession,$Id,$Value) $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$Id&"']") _WD_ElementAction($sSession,$sButton,'value', $Value) EndFunc Func _ChromeSetMouseClick($sSession,$Id,$Value) $sButton = _WD_FindElement($sSession,$_WD_LOCATOR_ByXPath,"//button[@type='"&$Id&"']") _WD_ElementAction($sSession, $sButton, 'click', $Value) EndFunc
  22. Hi Team, is there is a way to embed the webpage in auto it GUI using webdriver? what I want to do is that, I want to open edge browser inside the AutoIT GUI, in IE we have _IECreateEmbedded function but for the webdriver I am not able to find a function, please help Rohan M
  23. I am trying to hit the Return key without having to use the Send keys. I have the following code and its not hitting the Return key. Am I missing something? ; Press Return $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE006"},' ; Pause $sAction &= '{"type": "pause", "duration": 500},' ; Release Return $sAction &= '{"type": "keyUp", "value": "\uE006"}]}]}' _WD_Action($sSession, "actions", $sAction)
  24. I am trying to change the settings of the print option to Save as PDF and its not changing the settings and clicking on the Save button at the bottom. Here is my script that I have written and the format is correct below. Chrome browser I'm using is 97.0 My script was working fine using Chrome 95.0\ Not sure why its not working now It finds the print-preview-app element but not the others.
  25. I'm having an issue with my html paginated table. The script work as expected. It reads the html table and clicks on the Download button. However when it clicks on the next page its not iterating the items. instead it goes to the next URL from the spreadsheet and then iterates through the html table clicking the Download button and so on. Not sure why its doing that. I want it to click the next page and then continue iterating then after it has reached the end of the pagination go to the next url in the spreadsheet and repeat the process. Below is my script. Any help is appreciated 🙂
×
×
  • Create New...