sarge Posted May 19, 2020 Share Posted May 19, 2020 @Danp2Hello, In my case, this line worked: $sURL = GUICtrlRead($URL) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@href="&$sURL&"]") _WD_ElementAction($sSession, $sElement, 'click') Do not tell me, how to make browsers start in minimized mode? Link to comment Share on other sites More sharing options...
Danp2 Posted May 19, 2020 Author Share Posted May 19, 2020 @sarge The answer is "it depends on which browser you are using". What have you tried? Did you consider running the browser in headless mode? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
sarge Posted May 19, 2020 Share Posted May 19, 2020 (edited) @Danp2I use chrome No, I haven’t considered it, but I’ll use it if you tell me with which option this is implemented? Edited May 19, 2020 by sarge Link to comment Share on other sites More sharing options...
Danp2 Posted May 19, 2020 Author Share Posted May 19, 2020 @sarge I believe these topics have been previously discussed on the forum, so you should try using the search feature. If that doesn't yield the desired results, then try Google. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Purity8 Posted May 20, 2020 Share Posted May 20, 2020 (edited) I hope this isn't in the wrong section..if it is, I apologize in advance. Edited May 20, 2020 by Purity8 Link to comment Share on other sites More sharing options...
Danp2 Posted May 20, 2020 Author Share Posted May 20, 2020 @Purity8 This thread is for supporting the Webdriver UDF. If you aren't using that, then I think that you may have stumbled into the wrong thread. 😄 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Purity8 Posted May 20, 2020 Share Posted May 20, 2020 (edited) Hm, then...WebDriver refers to the use of Gecko & WinHttp/WD Functions? Or WinHttp excluded? Edited May 20, 2020 by Purity8 Link to comment Share on other sites More sharing options...
Danp2 Posted May 20, 2020 Author Share Posted May 20, 2020 Most of the available web browsers support the webdriver standards. You would use the Webdriver UDF to automate the browser of your choice. The WinHttp UDF is used by the Webdriver UDF to communicate with the webdriver console apps. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
sarge Posted May 20, 2020 Share Posted May 20, 2020 @Danp2Hello Headless mode implemented by one simple option "--headless" adding in $sDesiredCapabilities But for now, I need to control what is happening in the window. So the question remains, is it possible to launch browsers in minimized mode? And you did not answer, whether the functions still work: _WD_MoveMouseTo($sSession,$sElem), _WD_SetFocus($sSession,$sElem) ?? Link to comment Share on other sites More sharing options...
Danp2 Posted May 20, 2020 Author Share Posted May 20, 2020 1 hour ago, sarge said: So the question remains, is it possible to launch browsers in minimized mode? I previously suggested that you use the forum search feature or Google. What have you done to try to answer your own question? Quote And you did not answer, whether the functions still work: _WD_MoveMouseTo($sSession,$sElem), _WD_SetFocus($sSession,$sElem) ?? A couple of things I'd like to share with you about me -- I participate in these forums voluntarily because I enjoy it. I subscribe to the "teach a man to fish" philosophy, so I try to point folks in the right direction and allowing them to solve their own issues Some of our interactions haven't gone as well as I'd hoped. Not sure if there's a language barrier or some other issue. But the bottom line is that you need to start showing some effort to go allow with your questions. I'd like to make a few requests of you -- When you post code, it should be "stand alone" where we can copy / paste it into Scite and then run it without further modification. Don't just state that something doesn't work. Please include supporting details, like the Scite console output, so that we can better assist you. If I've pointed you in a direction, show that you attempted to research / solve the issue on your own. P.S. As far as the functions you've named above, these aren't part of the Webdriver UDF, so I have no way of knowing the answer to your question. My best guess would be Yes, they should still work on a minimized window. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
nooneclose Posted May 20, 2020 Share Posted May 20, 2020 @Danp2 is it possible to attached WebDriver to an already opened Microsoft Edge page? I would like to make an edge bot that can "start" (attach it's self to) on a already opened webpage and retrieve data from certain fields and click on elements. Thank you for your time. Link to comment Share on other sites More sharing options...
seadoggie01 Posted May 20, 2020 Share Posted May 20, 2020 @nooneclose Check out _WD_Attach in wd_helper.au3 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Danp2 Posted May 20, 2020 Author Share Posted May 20, 2020 @nooneclose I know this can be done with Firefox (see the Wiki FAQ section, but I don't recall if this can be accomplished with Chromium-based browsers. nooneclose 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
HJL Posted May 20, 2020 Share Posted May 20, 2020 Hi Dan, here is my next problem. I want to click a button that contains either ButtonGreen.png or ButtonRed.png or ButtonBlue.png. The XPath didn't help because the numbers 0, 1, 2 change. So I have to find the button with the png.s and then click it. I tried with $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id="content-form:favorites:0:fav-image"]") and _WD_ElementAction($sSession,$sElement,"click") and similiar, but because the number between :?: (...favorites:0:....) is not always connected with the the name I did not succeed. So it must be a search with "src" and after that a click. Do you have an idea? I tried for hours and it didn't work. form id="content-form" name="content-form" method="post" action="/auth-portal/heavy-login/secure/linklist.xhtml" enctype="application/x-www-form-urlencoded"> <input type="hidden" name="content-form" value="content-form" /> <span id="content-form:growl"></span><script id="content-form:growl_s" type="text/javascript">$(function(){PrimeFaces.cw("Growl","widget_content_form_growl",{id:"content-form:growl",sticky:false,life:10000,escape:true,keepAlive:false,msgs:[]});});</script><div id="content-form:favorites" class="ui-datagrid ui-widget linklistDataGrid"><div id="content-form:favorites_content" class="ui-datagrid-content ui-widget-content ui-grid ui-grid-responsive"><div class="ui-g"><div class="ui-datagrid-column ui-g-12 ui-md-1"> <div class="favListElement"><script type="text/javascript" src="/auth-portal/javax.faces.resource/jsf.js.xhtml?ln=javax.faces"></script><a id="content-form:favorites:0:extLink" href="#" onclick="mojarra.jsfcljs(document.getElementById('content-form'),{'content-form:favorites:0:extLink':'content-form:favorites:0:extLink'},'_blank');return false"><img id="content-form:favorites:0:fav-image" src="/auth-portal/javax.faces.resource/images/icons/vu/icon_ButtonGreen.png.xhtml?ln=heavy-login" alt="" style="width: 126px; height: 96px;" /><script id="content-form:favorites:0:j_idt94_s" type="text/javascript">$(function(){PrimeFaces.cw("Draggable","widget_content_form_favorites_0_j_idt94",{id:"content-form:favorites:0:j_idt94",target:"content-form:favorites:0:fav-image",cursor:"crosshair",containment:"#content-favorites",zIndex:9999,opacity:0.5,scope:"favorites",revert:"invalid",snap:true,snapTolerance:20,snapMode:"inner"});});</script><script id="content-form:favorites:0:j_idt95_s" type="text/javascript">$(function(){PrimeFaces.cw("Droppable","widget_content_form_favorites_0_j_idt95",{id:"content-form:favorites:0:j_idt95",target:"content-form:favorites:0:fav-image",hoverClass:"dropzoneHover",activeClass:"dropzoneActive",scope:"favorites",tolerance:"pointer",onDrop:handleDrop,behaviors:{drop:function(ext,event) {PrimeFaces.ab({s:"content-form:favorites:0:j_idt95",e:"drop",p:"content-form:favorites:0:j_idt95",u:"content-form:favorites"},ext);}}});});</script></a> </div></div><div class="ui-datagrid-column ui-g-12 ui-md-1"> <div class="favListElement"><a id="content-form:favorites:1:extLink" href="#" onclick="mojarra.jsfcljs(document.getElementById('content-form'),{'content-form:favorites:1:extLink':'content-form:favorites:1:extLink'},'_blank');return false"><img id="content-form:favorites:1:fav-image" src="/auth-portal/javax.faces.resource/images/icons/vu/icon_ButtonRed.png.xhtml?ln=heavy-login" alt="" style="width: 126px; height: 96px;" /><script id="content-form:favorites:1:j_idt94_s" type="text/javascript">$(function(){PrimeFaces.cw("Draggable","widget_content_form_favorites_1_j_idt94",{id:"content-form:favorites:1:j_idt94",target:"content-form:favorites:1:fav-image",cursor:"crosshair",containment:"#content-favorites",zIndex:9999,opacity:0.5,scope:"favorites",revert:"invalid",snap:true,snapTolerance:20,snapMode:"inner"});});</script><script id="content-form:favorites:1:j_idt95_s" type="text/javascript">$(function(){PrimeFaces.cw("Droppable","widget_content_form_favorites_1_j_idt95",{id:"content-form:favorites:1:j_idt95",target:"content-form:favorites:1:fav-image",hoverClass:"dropzoneHover",activeClass:"dropzoneActive",scope:"favorites",tolerance:"pointer",onDrop:handleDrop,behaviors:{drop:function(ext,event) {PrimeFaces.ab({s:"content-form:favorites:1:j_idt95",e:"drop",p:"content-form:favorites:1:j_idt95",u:"content-form:favorites"},ext);}}});});</script></a> </div></div><div class="ui-datagrid-column ui-g-12 ui-md-1"> <div class="favListElement"><a id="content-form:favorites:2:extLink" href="#" onclick="mojarra.jsfcljs(document.getElementById('content-form'),{'content-form:favorites:2:extLink':'content-form:favorites:2:extLink'},'_blank');return false"><img id="content-form:favorites:2:fav-image" src="/auth-portal/javax.faces.resource/images/icons/vu/icon_ButtonBlue.png.xhtml?ln=heavy-login" alt="" style="width: 126px; height: 96px;" /><script id="content-form:favorites:2:j_idt94_s" type="text/javascript">$(function(){PrimeFaces.cw("Draggable","widget_content_form_favorites_2_j_idt94",{id:"content-form:favorites:2:j_idt94",target:"content-form:favorites:2:fav-image",cursor:"crosshair",containment:"#content-favorites",zIndex:9999,opacity:0.5,scope:"favorites",revert:"invalid",snap:true,snapTolerance:20,snapMode:"inner"});});</script><script id="content-form:favorites:2:j_idt95_s" type="text/javascript">$(function(){PrimeFaces.cw("Droppable","widget_content_form_favorites_2_j_idt95",{id:"content-form:favorites:2:j_idt95",target:"content-form:favorites:2:fav-image",hoverClass:"dropzoneHover",activeClass:"dropzoneActive",scope:"favorites",tolerance:"pointer",onDrop:handleDrop,behaviors:{drop:function(ext,event) {PrimeFaces.ab({s:"content-form:favorites:2:j_idt95",e:"drop",p:"content-form:favorites:2:j_idt95",u:"content-form:favorites"},ext);}}});});</script></a> </div></div><div class="ui-datagrid-column ui-g-12 ui-md-1"> Link to comment Share on other sites More sharing options...
nooneclose Posted May 20, 2020 Share Posted May 20, 2020 (edited) @Danp2 Can I get WebDriver to click on an element that is three elements deep? In the picture I attached I wanted to have my bot click on the PO_App link but it is buried in a unordered list. How would I go about clicking on it? I tried $poApp = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@id='m7f8f3e49_ns_menu_PURCHASE_MODULE_sub_changeapp_PO_a']") _WD_ElementAction($sSession, $poApp, 'click') but nothing happened. Edited May 20, 2020 by nooneclose spelling mistakes Link to comment Share on other sites More sharing options...
Danp2 Posted May 20, 2020 Author Share Posted May 20, 2020 53 minutes ago, nooneclose said: I tried $poApp = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@id='m7f8f3e49_ns_menu_PURCHASE_MODULE_sub_changeapp_PO_a']") _WD_ElementAction($sSession, $poApp, 'click') but nothing happened. That's not entirely accurate. If you have everything setup correct, then the Scite console would contain the results from your efforts. This information could help identity why this didn't work. Without it, we can only guess. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
nooneclose Posted May 20, 2020 Share Posted May 20, 2020 (edited) @Danp2 I'm not sure I follow what you are saying. Are you saying that if I picked the right 'element' and 'tag' it would work despite if it is nested or not? I checked if it finds anything using consoleWrite and it does return this: f1f9bb69-f539-4fdb-b176-30b47f8c4aa0 Edited May 20, 2020 by nooneclose new info Link to comment Share on other sites More sharing options...
sarge Posted May 20, 2020 Share Posted May 20, 2020 @Danp2Hello, 9 hours ago, Danp2 said: I participate in these forums voluntarily because I enjoy it. I subscribe to the "teach a man to fish" philosophy, so I try to point folks in the right direction and allowing them to solve their own issues I apologize for the incorrectly asked questions above. I’ll try not to do that anymore. Thank you for your work. Link to comment Share on other sites More sharing options...
Danp2 Posted May 20, 2020 Author Share Posted May 20, 2020 @nooneclose That's not what I said. However, I believe that it is a true statement. 😃 If you run your script with $_WD_DEBUG = $_WD_DEBUG_Info, then the Scite console should be full of results. Sharing the pertinent portions of those results will help diagnose the issue. I suspect you are encounter the error $_WD_ERROR_ElementIssue when you call _WD_ElementAction. This would likely be caused by the target element not being visible (you can't click on a hidden element). Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted May 20, 2020 Author Share Posted May 20, 2020 @sarge No worries. Please report back once you attempted to resolve this yourself. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts