chrisgreece Posted January 12, 2020 Share Posted January 12, 2020 (edited) It is a website we use in police. And yes it does uses frames :/ I am trying to figure out the xpath now! God this is so frustrating Edited January 12, 2020 by chrisgreece Link to comment Share on other sites More sharing options...
Danp2 Posted January 12, 2020 Author Share Posted January 12, 2020 You'll need to switch to the correct frame before the element can be located / accessed. See DemoFrames function in wd_demo.au3 for an example of the available functions for accessing frames. chrisgreece 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
chrisgreece Posted January 12, 2020 Share Posted January 12, 2020 You are great! i figured it out with your help :))))) Local $sElement Sleep (2000) ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF) ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe[@name='_blank']") _WD_FrameEnter($sSession, $sElement) ConsoleWrite("TopWindowaaaaaaaaaaaaaaa=" & _WD_IsWindowTop($sSession) & @CRLF) Local Const $CTG = "//input[@id='katigoria_input']" $CTG1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $CTG) _WD_ElementAction($sSession, $CTG1, 'value', "CTG") _WD_LoadWait($sSession, 0) _WD_FrameLeave($sSession) ConsoleWrite("TopWindowbbbbbbbbbbbbbbbbbbbbbbbb=" & _WD_IsWindowTop($sSession) & @CRLF) Link to comment Share on other sites More sharing options...
chrisgreece Posted January 12, 2020 Share Posted January 12, 2020 Hey just an other stupid question and i really thank you in advance. Do you think it is possible to manipulate the attribute autocomplete in the html attribute from off to on using wd_element actions? Link to comment Share on other sites More sharing options...
Danp2 Posted January 12, 2020 Author Share Posted January 12, 2020 No... _WD_ElementAction will read an element's attributes or properties, but it doesn't offer a mechanism to update them (because it's not in the W3C specs). You should be able to do it with _WD_ExecuteScript. Figure out how to do it using Javascript in the browser's Developer Tools console. Once you have the correct syntax, then translate that for use in _WD_ExecuteScript. chrisgreece 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
chrisgreece Posted January 12, 2020 Share Posted January 12, 2020 Hey i am just trying to figure it out! is this the right way to pass js in Execute Script? _WD_ExecuteScript($sSession,$sScript['$('#ypalliloi_panel:first-child').attr("id");,$sArguments="[]"[,$lAsync = False]]') Thank you! By the way, i did copy the full xpath so i replaced imagesearch which i was using earlier for the buttons i asked! Thanks again! Link to comment Share on other sites More sharing options...
Danp2 Posted January 12, 2020 Author Share Posted January 12, 2020 1 hour ago, chrisgreece said: is this the right way to pass js in Execute Script? No... Like I said before, first figure out how to accomplish this (assuming it's even possible) using the browser's console. Then you should be able to convert that for use with _WD_ExecuteScript. Also, please stop with this stuff --> $sArguments="[]"[,$lAsync = False]. That's from the function header, which shows the proper syntax. The square brackets indicate that the parameter is optional. When calling the function, either leave out the parameter all together or supply an appropriate value. Some examples -- _WD_ExecuteScript($sSession,"$('#ypalliloi_panel:first-child').attr('id');") _WD_ExecuteScript($sSession,"$('#ypalliloi_panel:first-child').attr('id');", Default, False) _WD_ExecuteScript($sSession,"$('#ypalliloi_panel:first-child').attr('id');", "[]") Each one of these performs the exact same thing, since the 2nd and 3rd example simply supply the default value for the optional parameter. For examples of how to properly pass an element as a script argument, see _WD_SelectFiles and _WD_GetShadowRoot in wd_helper.au3. chrisgreece 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
caramen Posted January 13, 2020 Share Posted January 13, 2020 Hello @Danp2 Hope you doing well. Could you help me to target these elements please ? I'm in trouble because i know how to target like that : $sElement00001 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@aria-label='Savage']") ; Serveur savage _WD_ElementAction($sSession, $sElement00001 , 'click' ) But I don't know how to do when I have these sources : <div class="name-3_Dsmg">💻sécurité</div> <div class="name-3_Dsmg">🌍douane</div> How could I do to make the difference between them ? Do I have to use the same syntax ? My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Nine Posted January 13, 2020 Share Posted January 13, 2020 Start earlier with a unique tag and xpath to the target. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
caramen Posted January 13, 2020 Share Posted January 13, 2020 Hi thanks for helping @Nine Any exemple ? My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Nine Posted January 13, 2020 Share Posted January 13, 2020 Show more of your DOM so we can get you the right xpath to your situation. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
caramen Posted January 13, 2020 Share Posted January 13, 2020 (edited) It's discord windows in browser. If I want to click on "douane" or "sécurité" Do you need any more info ? My last failed attemp : $sElement00001 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@aria-label='Savage']") ; Serveur savage _WD_ElementAction($sSession, $sElement00001 , 'click' ) Sleep(800) ;~ Local $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='name-3_Dsmg']/douane","",True) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='name-3_Dsmg']") $sElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//douane", $sElement, True) _WD_ElementAction($sSession, $sElements , 'click' ) Edited January 13, 2020 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Nine Posted January 13, 2020 Share Posted January 13, 2020 I believe this xpath should work : "//div[@class='content-3at_AU']/div" “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
CYCho Posted January 13, 2020 Share Posted January 13, 2020 This may work. $sName = "douane" "//div[contains(text(), '" & $sName & "')]" caramen 1 zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
caramen Posted January 13, 2020 Share Posted January 13, 2020 This doesn't work : $sElement00001 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='content-3at_AU']/div") ; Serveur savage _WD_ElementAction($sSession, $sElement00001 , 'click' ) May you help better with this ? Look in this picture both are close each of other. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
caramen Posted January 13, 2020 Share Posted January 13, 2020 $sName = "douane" $sElement00001 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[contains(text(), '" & $sName & "')]") ; Serveur savage _WD_ElementAction($sSession, $sElement00001 , 'click' ) This work thanks ! My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Danp2 Posted January 13, 2020 Author Share Posted January 13, 2020 I think @CYCho is on the right track. This is what I was about to post -- _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[contains(text(),'douane')]") @caramen You should look into the ChroPath browser extension, which will help you with identifying proper xpath. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
caramen Posted January 13, 2020 Share Posted January 13, 2020 Yep correct, Ok, where please ? My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Danp2 Posted January 13, 2020 Author Share Posted January 13, 2020 Bet you can figure it out on your own with a little effort. 😜 caramen 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted January 13, 2020 Share Posted January 13, 2020 Nice extension Dan, thanks for sharing... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts