DMilton Posted February 9, 2017 Posted February 9, 2017 Hi! First of all, I want to thankfull your patience with me and my poor english. Web Example: https://www.wattpad.com/story/77589450-pass-the-cookies I have been searching for a problem with autoit in firefox automation. I have been for days searching all the forum for a solution and found no valid one. I can click on the most of the actions I need, but in some of the buttons I can't and I'm going really crazy. My Firefox version: 51.0.1 (32 bit) MozRepl: 1.1.2.1-signed.1-signed AutoIt: 3.3.14.2 Im on FF V0.6.0.1b-15 downloaded from this forum The cache has been removed. All the cookies removed. The involved html tags with one of the menus is: <button class="btn btn-orange btn-sm btn-left-align btn-right-align btn-story-lists on-dismiss-lists" data-story-id="77589450"> <span class="fa fa-plus fa-wp-white " aria-hidden="true" style="font-size:9px;"></span> </button> <div class="triangle"></div> <div class="dropdown-menu dropdown-menu-right add-to-library"> <ul class="lists-menu scrollable" data-story-id="77589450"> <li> <a class="on-modify-list" data-list-id="0"> <span class="fa fa-library fa-wp-mediumgrey " aria-hidden="true" style="font-size:autopx;"></span> <span class="reading-list-name">Mi Biblioteca (Privada)</span> My code: $xObj = "//main//button[@class='btn btn-orange btn-sm btn-left-align btn-right-align btn-story-lists on-lists-add-clicked']" _FFXPath($xObj) _FFCmd("FFau3.xpath.click()") Also tried: $xObj = "//main//button[@class='btn btn-orange btn-sm btn-left-align btn-right-align btn-story-lists on-lists-add-clicked']" _FFXPath($xObj) _FFCmd("FFau3.xpath.click()") $xObj = "//main//button[@class='btn btn-orange btn-sm btn-left-align btn-right-align btn-story-lists on-lists-add-clicked']" _FFXPath($xObj) _FFCmd("d=FFau3.WCD.createEvent('MouseEvent');d.initMouseEvent('mousedown',true,true,window,0,0,0,0,0,0,0,0,0,0,null);FFau3.xpath.dispatchEvent(d);") $xObj = "//main//button[@class='btn btn-orange btn-sm btn-left-align btn-right-align btn-story-lists on-lists-add-clicked']" $xPath = _FFXPath($xObj) _FFDisPatchEvent($xPath, "keypress", 13) $xObj = "//main//button[@class='btn btn-orange btn-sm btn-left-align btn-right-align btn-story-lists on-lists-add-clicked']" $xPath = _FFXPath($xObj) _FFDisPatchEvent($xPath, "mousedown") $xObj = "//main//button[@class='btn btn-orange btn-sm btn-left-align btn-right-align btn-story-lists on-lists-add-clicked']" $xPath = _FFXPath($xObj) _FFClick($xPath) Also tried with the same results with: $xObj = "//div[@class='dropdown-menu dropdown-menu-right add-to-library']" And for sure I'm missing many other failed attempts to click in the button. The MozRepl log: _FFConnect: OS: WIN_10 WIN32_NT 14393 _FFConnect: AutoIt: 3.3.14.2 _FFConnect: FF.au3: 0.6.0.1b-15 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4243 _FFConnect: Delay: 2ms _FFConnect: Socket: 744 _FFConnect: Browser: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0 __FFSendJavaScripts: Sending functions to FireFox .......... done __FFSend: try{FFau3 != null?1:0}catch(e){'_FFCmd_Err';}; __FFRecv: 1 __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//div[@class='dropdown-menu dropdown-menu-right add-to-library']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: [object HTMLDivElement] - {align: "", click: function() {...}, focus: function() {...}, blur: function() {...}, title: "", lang: "", dir: "", ...} __FFSend: try{FFau3.xpath.click()}catch(e){'_FFCmd_Err';}; __FFRecv: +>22:16:16 AutoIt3.exe ended.rc:0 +>22:16:16 AutoIt3Wrapper Finished. >Exit code: 0 Time: 2.873 Another log (with _FFClick function) _FFConnect: OS: WIN_10 WIN32_NT 14393 _FFConnect: AutoIt: 3.3.14.2 _FFConnect: FF.au3: 0.6.0.1b-15 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4243 _FFConnect: Delay: 2ms _FFConnect: Socket: 800 _FFConnect: Browser: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0 __FFSendJavaScripts: Sending functions to FireFox .......... done __FFSend: try{FFau3 != null?1:0}catch(e){'_FFCmd_Err';}; __FFRecv: 1 __FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//div[@class='dropdown-menu dropdown-menu-right add-to-library']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: [object HTMLDivElement] - {align: "", click: function() {...}, focus: function() {...}, blur: function() {...}, title: "", lang: "", dir: "", ...} __FFSend: try{FFau3.simulateEvent(FFau3.xpath,'MouseEvents','click');}catch(e){'_FFCmd_Err';}; __FFRecv: 1 _FFLoadWait: . loaded in 16ms [object HTMLDocument] - {search: {...}, location: {...}, getElementsByName: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...} +>22:22:41 AutoIt3.exe ended.rc:0 +>22:22:41 AutoIt3Wrapper Finished. >Exit code: 0 Time: 2.959 It seems to click the menu but does anything (16ms is not much). My last attempts have been with other versions of FF.au3 FF0.6.0.2 from Stilgar's webpage FF0.6.0.1b-10 and a large etc. At last I modified FF.au3 script: _FFCmd('FFau3.simulateEvent=function simulateEvent(a,b,c){try{var d=document.createEvent(b);switch(b){case"MouseEvents":d.initMouseEvent(c,true,true,window,0,0,0,simulateEvent.arguments[4],simulateEvent.arguments[5],false,false,false,false,0,null);break;case"KeyboardEvent":d.initKeyEvent(c,true,true,null,false,false,false,false,simulateEvent.arguments[3],0);break;case"Event":d.initEvent(c,true,true);break}a.dispatchEvent(d);return 1}catch(e){return-3}return 0};') With _FFCmd('FFau3.simulateEvent=function simulateEvent(a,b,c){try{var d=FFau3.WCD.createEvent(b);switch(b){case"MouseEvents":d.initMouseEvent(c,true,true,window,0,0,0,simulateEvent.arguments[4],simulateEvent.arguments[5],false,false,false,false,0,null);break;case"KeyboardEvent":d.initKeyEvent(c,true,true,null,false,false,false,false,simulateEvent.arguments[3],0);break;case"Event":d.initEvent(c,true,true);break}a.dispatchEvent(d);return 1}catch(e){return-3}return 0};') I have tried to do the stuff with iMacros for Firefox extension and it works fine with only one line of simple code, but I want to use autoit because I love it! VERSION BUILD=9030808 RECORDER=FX EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(3)>DIV>DIV>DIV>MAIN>DIV>DIV>DIV>BUTTON" BUTTON=0 Anyone knows what the hell I'm doing wrong? Thanks in advance and sorry for the large extension of the post.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now