naixZ94 Posted March 22, 2023 Share Posted March 22, 2023 15 hours ago, mLipok said: Have you tried with FireFox or MS EDGE? What about these browsers? I did not. The first time i used webdriver i had trouble with Firefox and Edge. Chrome worked so i never looked back. i try to test it in the next days with Firefox and Edge. I have one more question. I try to click the highlighted button in a shadow root. I tried this so far. $sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='usercentrics-root']") ConsoleWrite("$sRoot = " & $sRoot & @CRLF) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[contains(text(),'Alles akzeptieren')], $sRoot, "", True) ConsoleWrite("$sElement = " & $sElement & @CRLF) _WD_ElementAction($sSession, $sElement, "click") _WD_GetShadowRoot seems to work but i cant find the button to click on. _WD_FindElement does not return any value. The XPath query is working on other websites with no shadow root folder if i change the 'Alles akzeptieren' to the right button text value. __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//*[@id='usercentrics-root'] StartNodeID= Multiple=Default ShadowRoot=Default __WD_Get ==> Success [0] : HTTP status = 200 _WD_ElementAction ==> Success [0] : Parameters: Command=shadow Option=Default _WD_GetShadowRoot ==> Success [0] : Parameters: Strategy=xpath Selector=//*[@id='usercentrics-root'] StartElement=Default $sRoot = 88c20f5f-4724-442b-ac39-2a7ae1202573 _WD_FindElement ==> Invalid Expression [11] : Parameters: Strategy=xpath Selector=//button[contains(text(),'Alles akzeptieren')] StartNodeID=88c20f5f-4724-442b-ac39-2a7ae1202573 Multiple= ShadowRoot=True $sElement = __WD_Post ==> No match [8] : HTTP status = 404 _WD_ElementAction ==> No match [8] : Parameters: Command=click Option=Default Link to comment Share on other sites More sharing options...
mLipok Posted March 22, 2023 Share Posted March 22, 2023 You have issue in your code: $sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='usercentrics-root']") ConsoleWrite("$sRoot = " & $sRoot & @CRLF) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[contains(text(),'Alles akzeptieren')], $sRoot, "", True) ConsoleWrite("$sElement = " & $sElement & @CRLF) _WD_ElementAction($sSession, $sElement, "click") there is lack of double quotes should be: $sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='usercentrics-root']") ConsoleWrite("$sRoot = " & $sRoot & @CRLF) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[contains(text(),'Alles akzeptieren')]", $sRoot, "", True) ConsoleWrite("$sElement = " & $sElement & @CRLF) _WD_ElementAction($sSession, $sElement, "click") 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...
naixZ94 Posted March 22, 2023 Share Posted March 22, 2023 1 minute ago, mLipok said: You have issue in your code: $sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='usercentrics-root']") ConsoleWrite("$sRoot = " & $sRoot & @CRLF) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[contains(text(),'Alles akzeptieren')], $sRoot, "", True) ConsoleWrite("$sElement = " & $sElement & @CRLF) _WD_ElementAction($sSession, $sElement, "click") there is lack of double quotes should be: $sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='usercentrics-root']") ConsoleWrite("$sRoot = " & $sRoot & @CRLF) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[contains(text(),'Alles akzeptieren')]", $sRoot, "", True) ConsoleWrite("$sElement = " & $sElement & @CRLF) _WD_ElementAction($sSession, $sElement, "click") Hi i saw this after my post was submitted. The " is not missing in my real code, its still not working, the console output is the same. $sElement dont get any value. Link to comment Share on other sites More sharing options...
mLipok Posted March 22, 2023 Share Posted March 22, 2023 Ah you have ShadowRoot. Which browser do you use ? If this is FireFox that I want to say to you that this is a know bug: https://github.com/Danp2/au3WebDriver/issues/26#issuecomment-1473758459 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...
naixZ94 Posted March 22, 2023 Share Posted March 22, 2023 I dont use Firefix. I use chrome for my script. Link to comment Share on other sites More sharing options...
Danp2 Posted March 22, 2023 Author Share Posted March 22, 2023 (edited) _WD_FindElement enforces a relative xpath when a starting node is used. This was previously discussed here. This isn't an arbitrary restriction that I would have implemented, so it must come from the W3C specs. Edit: Here is the GH issue where this was addressed -- https://github.com/Danp2/au3WebDriver/issues/39 Edited March 22, 2023 by Danp2 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
naixZ94 Posted March 22, 2023 Share Posted March 22, 2023 @Danp2 Thx for your reply. i tried to modifie my script and have something like this. $sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='usercentrics-root']") ConsoleWrite("$sRoot = " & $sRoot & @CRLF) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/.div/div/div[2]/div/div[2]/div/div[2]/div/div/div[2]/div/button[3]", $sRoot, "", True) ConsoleWrite("$sElement = " & $sElement & @CRLF) This is the output from the console: __WD_Post ==> Success [0] : HTTP status = 200 _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//*[@id='usercentrics-root'] StartNodeID= Multiple=Default ShadowRoot=Default __WD_Get ==> Success [0] : HTTP status = 200 _WD_ElementAction ==> Success [0] : Parameters: Command=shadow Option=Default _WD_GetShadowRoot ==> Success [0] : Parameters: Strategy=xpath Selector=//*[@id='usercentrics-root'] StartElement=Default $sRoot = 203a1715-8eeb-4795-8c72-cb4834cf7276 _WD_FindElement ==> Invalid Expression [11] : Parameters: Strategy=xpath Selector=/.div/div/div[2]/div/div[2]/div/div[2]/div/div/div[2]/div/button[3] StartNodeID=203a1715-8eeb-4795-8c72-cb4834cf7276 Multiple= ShadowRoot=True $sElement = I dont know if the xpath string is correct, i cant test it anywhere before running the script. i try to click the cookie accept button on this websitehttps://www.na-kd.com/de Link to comment Share on other sites More sharing options...
Danp2 Posted March 22, 2023 Author Share Posted March 22, 2023 @naixZ94You've got the period in the wrong location. It goes before the first slash, not after it. P.S. You could also try locating it with CSS instead of xpath. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
bogQ Posted March 23, 2023 Share Posted March 23, 2023 (edited) Do not have his full code but he will need to add some sleep after page load or some other func _WD_WaitElement maybe?. Shadow root main element is maybe defined on page load but its html content is generated later probably on document ready with js/jquery. Some sleep after page load will result in correct selector. _WD_Navigate($sSession, "https://www.na-kd.com/de") Sleep(10000) $sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByCSSSelector, "#usercentrics-root") $sHTML = _WD_ElementAction($sSession, $sRoot, 'property', 'innerHTML') ConsoleWrite("source: [" & $sHTML & "]" & @CRLF) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "button:last-child", $sRoot, Default, True) _WD_ElementAction($sSession, $sElement, "click") Edited March 23, 2023 by bogQ mLipok 1 TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
mLipok Posted March 23, 2023 Share Posted March 23, 2023 @bogQ Thanks. Based on your information, I think it works like multiple nested frames where each document can be generated separately. Currently _WD_WaitLoad() waits only on current document (usually main document not any frames), and such behavior is true as long as you wont switch to other frames and use _WD_WaitLoad() for the other frames too. So I wonder if ShadowRoot should be considered as separate document which also should be checked for ReadyState. 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...
bogQ Posted March 23, 2023 Share Posted March 23, 2023 @mLipok Its nothing wrong to wait for element to spawn in existence. So I do not think it will never need ReadyState, read below. I think it all depends of site code and its implementation of shadow doom. For this specific case I am presuming (from logs) that site created shadow doom from the start as this structure representation... <div id="usercentrics-root" data-created-at="1679569636197" style=""> #shadow-root (open) <div data-nosnippet="1" data-testid="uc-app-container"></div> </div> and only after that on page load event he populated its data inside attribute testid="uc-app-container" div element when he detected that user did not have cookie where he accepted cookies. I do not think that await/promises can count that page still is not loaded if used in this case, so that is why ReadyState (in my head) should not happen for shadow doom. Think this site was a specific case and nothing else. If you asked me (if i coeede with selenium in python) I would just remove that element with js so that it whud not interfere with other automation or just use js.click instead selenium.click. Who need to accept cookies this dayes 😀 ... TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
mLipok Posted March 23, 2023 Share Posted March 23, 2023 @bogQ Please take a look on: https://github.com/Danp2/au3WebDriver/issues/353 Especially: Quote wondering if such readyState checking is possible: document.querySelector("body > print-preview-app").shadowRoot.querySelector("#sidebar").shadowRoot.document.readyState 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 March 23, 2023 Share Posted March 23, 2023 (edited) as so far I'm not familiar with ShadowRoot So I want to ask about your snippet 5 minutes ago, bogQ said: <div id="usercentrics-root" data-created-at="1679569636197" style=""> #shadow-root (open) <div data-nosnippet="1" data-testid="uc-app-container"></div> </div> In this scenario you (open) #shadow-root and I wonder where it closes. Edited March 23, 2023 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...
bogQ Posted March 23, 2023 Share Posted March 23, 2023 (edited) 6 minutes ago, mLipok said: @bogQ Please take a look on: https://github.com/Danp2/au3WebDriver/issues/353 Especially: that is why in selenium there is for example: Quote WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.ID, "myDynamicElement")) So i presume that "_WD_WaitElement" is equivalent of that in WebDriver UDF? Edited March 23, 2023 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
mLipok Posted March 23, 2023 Share Posted March 23, 2023 1 minute ago, bogQ said: So i presume that "_WD_WaitElement" is equivalent of that in WebDriver UDF? I think that you did correct comparition, but @Danp2 have better experience to confirm (especially that I do not know selenium). 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...
bogQ Posted March 23, 2023 Share Posted March 23, 2023 (edited) 21 minutes ago, mLipok said: as so far I'm not familiar with ShadowRoot So I want to ask about your snippet In this scenario you (open) #shadow-root and I wonder where it closes. I think it does not close, to me its just a info block that say "hey there is something below me" but represanted with that text. Most of the time i had to interact with shadow it was because of Carbon Design. Eather way you can read some basic info about shadow on this link https://javascript.info/shadow-dom (its not too long and explanation is good and breaf) and on this page if your interested is css cove with some handeling for "::part()" https://css-tricks.com/styling-in-the-shadow-dom-with-css-shadow-parts/ and for ":host()" https://developer.mozilla.org/en-US/docs/Web/CSS/:host Edited March 23, 2023 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
bogQ Posted March 23, 2023 Share Posted March 23, 2023 (edited) 33 minutes ago, mLipok said: as so far I'm not familiar with ShadowRoot So I want to ask about your snippet In this scenario you (open) #shadow-root and I wonder where it closes. Maybe i misunderstood, this is not a snippet this is just structure representation. I do not think you can create it with html. As far as i know it is created only with js and attached with it to some html element. "#shadow-root (open)" text is just there to inform you that it exist. Edited March 23, 2023 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
naixZ94 Posted March 24, 2023 Share Posted March 24, 2023 On 3/23/2023 at 12:42 AM, Danp2 said: @naixZ94You've got the period in the wrong location. It goes before the first slash, not after it. P.S. You could also try locating it with CSS instead of xpath @Danp2 its not working with xpath,even with the period in the right location. But i got it to working with a different selector. $sRoot = _WD_GetShadowRoot($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='usercentrics-root']") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, ".sc-eDvSVe.jIuKWg", $sRoot, "", True) _WD_ElementAction($sSession, $sElement, "click") Link to comment Share on other sites More sharing options...
tac7 Posted April 6, 2023 Share Posted April 6, 2023 Hello All, I dont undestand, before a few day or week ago, when I made a: _WD_Window($sSession, 'Switch', '{"handle":"' & $sCurrentTabHandle & '"}') the FF or Edge windows was put at foreground, but today only the Edge windows is put at foreground and FF stay at the back of the other windows !! I also tried with : _WD_ExecuteScript($sSession, "window.focus();", Default, Default, $_WD_JSON_Value) ; But no way! Here my last updates for webdriver, winhttp !! and "geckodriver-v0.33.0-win64" _WD_GetFreePort ==> Success [0] : 4444 _WD_IsLatestRelease ==> Success [0] : True _WD_Startup: OS: WIN_10 WIN32_NT 19044 _WD_Startup: AutoIt: 3.3.16.0 _WD_Startup: Webdriver UDF: 0.13.0 (Up to date) _WD_Startup: WinHTTP: 1.6.4.2 _WD_Startup: Driver: geckodriver.exe (64 Bit) _WD_Startup: Params: --log trace _WD_Startup: Port: 4444 _WD_Startup: Command: "geckodriver.exe" --log trace _WD_Startup ==> Success [0] > capabilities OUT = { "capabilities":{ "alwaysMatch":{ "browserName":"firefox", "acceptInsecureCerts":true } } } Thanks a lot for your help Link to comment Share on other sites More sharing options...
Danp2 Posted April 6, 2023 Author Share Posted April 6, 2023 @tac7 This is something that you should be able to troubleshoot yourself and then report back with the results. Here are some things you can try -- Revert to the prior version of geckodriver Revert to the prior version of the UDF library Let us know how it goes. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts