hahnhwang Posted October 19, 2022 Share Posted October 19, 2022 4 hours ago, SkysLastChance said: thank you so much; when I finish this script, I will no longer depend on MS Power Automate for my daily task @hahnhwang https://www.autoitscript.com/wiki/WebDriver#FAQ #7 You don't need an array in this case. However, Local $sElement = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="mat-tab-label-0-0"]/div/span/app-number-viewerapp', 100, 5000) Local $sText = _WD_ElementAction($sSession, $sElement, 'property', 'innerText') MsgBox(0, "Total", $sText) SkysLastChance 1 Link to comment Share on other sites More sharing options...
mLipok Posted November 10, 2022 Share Posted November 10, 2022 (edited) on one PC I get such error: Quote geckodriver.exe: error: Została podjęta próba uzyskania dostępu do gniazda w sposób zabroniony przez przypisane do niego uprawnienia dostępu. (os error 10013) geckodriver 0.32.0 (4563dd583110 2022-10-13 09:22 +0000) WebDriver implementation for Firefox google translate: Quote geckodriver.exe: error: An attempt was made to access a socket in a manner forbidden by the access rights assigned to it. (os error 10013) geckodriver 0.32.0 (4563dd583110 2022-10-13 09:22 +0000) WebDriver implementation for Firefox Anybody hit the problem ? EDIT: As so far I found: https://github.com/mozilla/geckodriver/issues/550 https://github.com/mozilla/geckodriver/issues/1208 But in my case it looks like this is not a FIREWALL problem, but I can be wrong. Edited November 10, 2022 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted November 10, 2022 Share Posted November 10, 2022 (edited) Found solution. In order to solve this issue I had to modify _WD_StartUp() by adding --port parameter to the command : Local $sCommand = StringFormat('"%s" %s ', $_WD_DRIVER, $_WD_DRIVER_PARAMS & " --port=" & $_WD_PORT ) EDIT: Should we add this as a default fix to wd_core.au3 ? Edited November 10, 2022 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Danp2 Posted November 10, 2022 Author Share Posted November 10, 2022 @mLipokDon't change _WD_Startup. You should Instead use _WD_Option to add that setting if needed. For example -- $iAltPort = 4567 _WD_Option('DriverParams', '--log trace --port=' & $iAltPort) _WD_Option('Port', $iAltPort) P.S. You didn't provide enough details for us to know if you are using the standard port number or a different one. 😏 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
mLipok Posted November 11, 2022 Share Posted November 11, 2022 (edited) On 11/10/2022 at 1:34 PM, Danp2 said: @mLipokDon't change _WD_Startup. You should Instead use _WD_Option to add that setting if needed. For example -- $iAltPort = 4567 _WD_Option('DriverParams', '--log trace --port=' & $iAltPort) _WD_Option('Port', $iAltPort) so I suggest to modify _WD_Startup() in this way: ;~ Local $sCommand = StringFormat('"%s" %s ', $_WD_DRIVER, $_WD_DRIVER_PARAMS) If Not StringInStr($_WD_DRIVER_PARAMS, "--port") Then $_WD_DRIVER_PARAMS &= " --port=" & $_WD_PORT Local $sCommand = StringFormat('"%s" %s ', $_WD_DRIVER, $_WD_DRIVER_PARAMS) Because if user specify port by this: _WD_Option('Port', $iAltPort) then it should be no need to again set the option (port) by this: _WD_Option('DriverParams', '--log trace --port=' & $iAltPort) I mean it is redundant _WD_Option() usage, because when it is set once, it should be set properly, so this: _WD_Option('Port', $iAltPort) should be the only one needed. Can you agree with my reasoning ? Edited November 11, 2022 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Danp2 Posted November 11, 2022 Author Share Posted November 11, 2022 @mLipokIf you are not using the default port for webdriver communication, then you must notify the webdriver of the alternate port. This is what is occurring in the 'DriverParams' line. I understand why you want to make this change. However, I believe that it isn't needed as the vast majority scripts will use the default port number. Also, the following is valid for geckodriver and your change could lead to unexpected results -- _WD_Option('DriverParams', '-p ' & $iAltPort) This issue has definitely come up previously, so this could make a good FAQ. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jiataifeng Posted November 14, 2022 Share Posted November 14, 2022 Have anyone tried Google calendar? It seems it can not find anything with _WD_FindElement Link to comment Share on other sites More sharing options...
jiataifeng Posted November 14, 2022 Share Posted November 14, 2022 (edited) 13 hours ago, jiataifeng said: Have anyone tried Google calendar? It seems it can not find anything with _WD_FindElement it would return something like this __WD_Post: URL=HTTP://127.0.0.1:9515/session/147c20d2cde2adb344f3397afad8cda8/element; $sData={"using":"xpath","value":"//div[@role='button']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"0ad86d88-d76b-4640-a895-43ec547b02b3"}} _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"0ad86d88-d76b-4640-a895-43ec547b02b3"}} is the page source code encrypted? It seems what the program gets is not what we see in f12 developing window. @Danp2any comments? please help, thanks. Edited November 14, 2022 by jiataifeng Link to comment Share on other sites More sharing options...
Danp2 Posted November 14, 2022 Author Share Posted November 14, 2022 15 hours ago, jiataifeng said: Have anyone tried Google calendar? It seems it can not find anything with _WD_FindElement _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"0ad86d88-d76b-4640-a895-43ec547b02b3"}} The above shows that the element was in fact found. Now you need to do something with it. What's your next step. Do you need to click it, retrieve its value, or something else? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jiataifeng Posted November 14, 2022 Share Posted November 14, 2022 1 hour ago, Danp2 said: The above shows that the element was in fact found. Now you need to do something with it. What's your next step. Do you need to click it, retrieve its value, or something else? try to click it. but why it's so different? Link to comment Share on other sites More sharing options...
Danp2 Posted November 14, 2022 Author Share Posted November 14, 2022 @jiataifengYes, webdriver can take some getting used to. Don't concern yourself with the JSON string being returned. It's simply a GUID that webdriver uses to identify the element. Just make sure the request succeeded (check @error) and then proceed with your next step. You may want to check out the section on the wiki that discusses transitioning from IE. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jiataifeng Posted November 30, 2022 Share Posted November 30, 2022 (edited) @Danp2 When available, could you take a look of Google Calendar? I don't know how to set the value of the highlighted part, though tried for a very long time. Thank you Edited November 30, 2022 by jiataifeng Link to comment Share on other sites More sharing options...
mLipok Posted November 30, 2022 Share Posted November 30, 2022 Did you try JS ? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Danp2 Posted November 30, 2022 Author Share Posted November 30, 2022 @jiataifengI took a quick look, but didn't see an immediate solution. SelectorsHub reported that it is inside a Shadowroot, but I didn't see it when I checked. 🤷♂️ Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
dadLog Posted December 11, 2022 Share Posted December 11, 2022 Hello! Please, help with _WD_FindElement() , parameter $sStartNodeID I could not find an example in wd_demo.au3 I am trying to take text from a table, rows have a common class I use _WD_FindElement and $bMultiple to get an array of string id Then I try to retrieve cells with text from these rows using $sStartNodeID xpath line checked in chrome Please tell me the syntax of the command in my example Try $sStartNodeID = '//tr/td[1]/span/text()' , '/tr/td[1]/span/text()' , 'tr/td[1]/span/text()' '//td[1]/span/text()' , '/td[1]/span/text()' , 'td[1]/span/text()' expandcollapse popup#include "wd_capabilities.au3" #include "wd_helper.au3" Global $sURL = 'file:///D:/Work/test-table.html' , $WD_SESSION , $sStatus _WD_start () $idElementS = _WD_FindElement($WD_SESSION, $_WD_LOCATOR_ByXPath, "//tr[contains(@class,'MuiTableRow')]" , Default , True ) $iSizeOfArray = UBound ($idElementS) MsgBox ('','','Number of Rows = ' & $iSizeOfArray) For $i = 0 to $iSizeOfArray-1 $idElem = $idElementS[$i] $sTd1 = _WD_FindElement($WD_SESSION, $_WD_LOCATOR_ByXPath, "/tr/td[1]/span/text()" , $idElem ) $sTd2 = _WD_FindElement($WD_SESSION, $_WD_LOCATOR_ByXPath, "/tr/td[2]/span/text()" , $idElem ) $sTd3 = _WD_FindElement($WD_SESSION, $_WD_LOCATOR_ByXPath, "/tr/td[3]/span/text()" , $idElem ) Next _WD_DeleteSession($WD_SESSION) _WD_Shutdown() Func _WD_start () ; startup - cleaning internal capabilities JSON object _WD_CapabilitiesStartup() ; starting with "alwaysMatch" settings _WD_CapabilitiesAdd("alwaysMatch") _WD_CapabilitiesAdd("acceptInsecureCerts", True) ; switching to "firstMatch" with "chrome" which will specify to use "goog:chromeOptions" _WD_CapabilitiesAdd("firstMatch", "chrome") ; setting vendor specific "goog:chromeOptions" settings _WD_CapabilitiesAdd("w3c", True) _WD_CapabilitiesAdd("prefs", "download.default_directory", @ScriptDir & "\Downloads") _WD_CapabilitiesAdd("excludeSwitches", "enable-automation") ; get/assign Capabilities JSON Object content to string Local $sCapabilities = _WD_CapabilitiesGet() #EndRegion - creating capabilities string ; setting WebDriver options _WD_Option("Driver", @ScriptDir & "\chromedriver.exe") _WD_Option("Port", 9515) _WD_Option("DefaultTimeout", 1000) ; starting WebDriver with specified options _WD_Startup() $WD_SESSION = _WD_CreateSession($sCapabilities) _WD_Navigate($WD_SESSION, $sURL) EndFunc But I always get an error - "Invalid Expression [11]" _WD_FindElement ==> Invalid Expression [11] : Parameters: Strategy=xpath Selector=//tr/td[1]/span/text() StartNodeID=32f30f9f-e53a-442a-aa6e-3427ea20c286 Multiple=Default ShadowRoot=Default .... _WD_FindElement ==> Invalid Expression [11] : Parameters: Strategy=xpath Selector=/tr/td[1]/span/text() StartNodeID=dc0248c3-22ed-4f49-a431-6f0380dfc04b Multiple=Default ShadowRoot=Default ... _WD_FindElement ==> Invalid Expression [11] : Parameters: Strategy=xpath Selector=tr/td[1]/span/text() StartNodeID=17871eb6-5ccf-4bba-9bf9-d015248b9aa8 Multiple=Default ShadowRoot=Default ... _WD_FindElement ==> Invalid Expression [11] : Parameters: Strategy=xpath Selector=//td[1]/span/text() StartNodeID=69516889-6e17-4c65-846f-c1c397aeba97 Multiple=Default ShadowRoot=Default ... _WD_FindElement ==> Invalid Expression [11] : Parameters: Strategy=xpath Selector=/td[1]/span/text() StartNodeID=5e99e034-ad4b-4f7b-8518-29f0bd26ba34 Multiple=Default ShadowRoot=Default ... _WD_FindElement ==> Invalid Expression [11] : Parameters: Strategy=xpath Selector=td[1]/span/text() StartNodeID=5a9d4385-6a54-4160-a5f4-0b02d0a2c0a7 Multiple=Default ShadowRoot=Default HTML table in attach. I am immensely grateful for your help! test-table.html Link to comment Share on other sites More sharing options...
Danp2 Posted December 11, 2022 Author Share Posted December 11, 2022 You must use a relative selector when using xpath with a starting node. You also need to obtain the element's text separately. Instead of this -- $sTd1 = _WD_FindElement($WD_SESSION, $_WD_LOCATOR_ByXPath, "/tr/td[1]/span/text()" , $idElem ) You need to do it like this -- $idElem = _WD_FindElement($WD_SESSION, $_WD_LOCATOR_ByXPath, "./td[1]/span" , $idElem) $sContents = _WD_ElementAction($WD_SESSION, $idElem, 'text') Another option would be to use _WD_GetTable to obtain an array containing the table's contents. dadLog 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
dadLog Posted December 11, 2022 Share Posted December 11, 2022 Danp2 - you are divine! Thanks for the tip about _WD_GetTable , I used it, but because of the complex cell contents I need individual access to each cell. You have solved my problem. Thank you so much! Danp2 1 Link to comment Share on other sites More sharing options...
noellarkin Posted December 17, 2022 Share Posted December 17, 2022 After updating geckodriver.exe to 0.32.0 I'm getting the following error: __WD_Post ==> Webdriver Exception [10] : HTTP status = 500 ResponseText={"value":{"error":"session not created","message":"Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line","stacktrace":""}} Also, I usually run scripts with SciTE-Lite, but I've been playing around with Notepad++ NppExec as well - - when I run any webdriver related scripts with NppExec I get the following error: _WD_Startup ==> File issue [18] : Non-existent Web Driver: geckodriver.exe I don't get this error with SciTE-Lite. What could be the reason? I've only had this issue with anything related to geckodriver.exe. I have geckodriver.exe in PATH. Link to comment Share on other sites More sharing options...
Danp2 Posted December 17, 2022 Author Share Posted December 17, 2022 @noellarkinIIRC, this occurs with the 32 bit version of Geckodriver. You need to either switch to the 64 bit version or supply the binary location as part of your capabilities string. Quote _WD_Startup ==> File issue [18] : Non-existent Web Driver: geckodriver.exe This feature was added by @mLipokhere. The current implementation requires you to either provide the full path to the webdriver or it must exist in the current working directory. Unsure why it works in one editor and not the other. noellarkin 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
noellarkin Posted December 17, 2022 Share Posted December 17, 2022 I was able to get it working by moving the geckodriver.exe to the Include folder, as well as using the x64 version. Thanks for clarifying. However, the SciTE/Notepad++ issue remains, still getting "Non-existent Web Driver: geckodriver.exe " when using NppExec. Link to comment Share on other sites More sharing options...
Recommended Posts