Iczer Posted September 15, 2013 Posted September 15, 2013 To start a download you can click on the download link (_FFClick) I'm using that, as it's the only method to add file to FF internal download manager, but it also make me tackle MozillaDialogClass windows. What i wanted - is some direct function to add file/link to FF internal download manager. Without it _FF_DM.au3 is not complete i think...
Stilgar Posted September 15, 2013 Author Posted September 15, 2013 (edited) I'm using that, as it's the only method to add file to FF internal download manager, but it also make me tackle MozillaDialogClass windows. What i wanted - is some direct function to add file/link to FF internal download manager. Without it _FF_DM.au3 is not complete i think... I'm waiting for the new interface but it is still under developement:https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Downloads.jsm Edited September 15, 2013 by Stilgar jEdit4AutoIt PlanMaker_UDF
pacl Posted September 22, 2013 Posted September 22, 2013 looks good but I got error both on V0.6.0.0b and V0.6.0.1b-9 C:AUTOIT~1Includeff.au3 (1) : ==> Unable to parse line.: is there any requirement for AUTOIT? My version is 323
Danp2 Posted September 27, 2013 Posted September 27, 2013 (edited) I'm observing the following in the output window of SciTE: __FFWaitForRepl ==> Error TCPSend / TCPRecv: TCPRecv :-1 I believed this started with the most recent update to b-9. Is this something to be concerned about? After more testing, it appears to only occur while using the current beta version. Dan Edited September 27, 2013 by Danp2 Latest Webdriver UDF Release Webdriver Wiki FAQs
frank10 Posted September 29, 2013 Posted September 29, 2013 (edited) Thank you Stilgar for FF.au3! I have some 'a' urls that contains "/details/" word, like: a href = "http://www.***.com/v/details/sse..." a href = "http://www.***.com/v/details/doms/..." I tried: $aName = _FFXpath("//a[contains(@href,'details')]", "href", 6) _ArrayDisplay($aName) and it works. I would also exclude some others that have another word, something like: $aName = _FFXpath("//a[contains(@href,'details') and not contains(@href, 'slow')]", "href", 6) This doesn't work. It seems doesn't exist the NOT operator: http://www.w3schools.com/xpath/xpath_operators.asp That's strange, there is the or, and... Obviously I can get all a and then check with StringInstr, but I'm asking for xpath. Edited September 29, 2013 by frank10
frank10 Posted October 1, 2013 Posted October 1, 2013 looks good but I got error both on V0.6.0.0b and V0.6.0.1b-9 C:AUTOIT~1Includeff.au3 (1) : ==> Unable to parse line.: is there any requirement for AUTOIT? My version is 323 In version b-11 I had to change some lines in the FF.au3 from "Or_" to the correct: "Or _" Try to see if that's the case.
Stilgar Posted October 1, 2013 Author Posted October 1, 2013 Thank you Stilgar for FF.au3! I have some 'a' urls that contains "/details/" word, like: a href = "http://www.***.com/v/details/sse..." a href = "http://www.***.com/v/details/doms/..." I tried: $aName = _FFXpath("//a[contains(@href,'details')]", "href", 6) _ArrayDisplay($aName) and it works. I would also exclude some others that have another word, something like: $aName = _FFXpath("//a[contains(@href,'details') and not contains(@href, 'slow')]", "href", 6) This doesn't work. It seems doesn't exist the NOT operator: http://www.w3schools.com/xpath/xpath_operators.asp That's strange, there is the or, and... Obviously I can get all a and then check with StringInstr, but I'm asking for xpath. NOT is not an operator, it's a funktion: http://www.w3schools.com/xpath/xpath_functions.asp#boolean This should work: $aName = _FFXpath("//a[contains(@href,'details') and not(contains(@href, 'slow'))]", "href", 6) jEdit4AutoIt PlanMaker_UDF
frank10 Posted October 2, 2013 Posted October 2, 2013 That worked, thank you. I have another problem: I have an array of links (a lot of) I load on a tab and then get a link inside of the page that downloads a file. In every page there is also a flash preview: I eliminate that changing the innerHTML of the div, so I don't hear the audio. After loading about 20-30 pages one after the other, Firefox begins to slow down the loading and I can hear some audio before the innerHTML change. But the worst is that at a certain point it doesn't finish the loading of the page. And FF.au3 gives timeout error, like this: _FFLoadWait: ...................................................................................................................................................................................................................................................................................................................................................................................................................................................................[object XrayWrapper [object HTMLDocument]] - {loadedUriSpecs: {...}, __noscriptStorage: {...}, __noScriptEarlyScripts__: "http://www.videoblocks.com/videos/details/ident-piano-intro-2/", _noscriptAfterSurrogates: true, location: {...}, zenbox_close: {...}, s_m: function() {...}, ...} [object XrayWrapper [object HTMLDocument]] - {loadedUriSpecs: {...}, __noscriptStorage: {...}, __noScriptEarlyScripts__: "http://www.*********tro-2/", _noscriptAfterSurrogates: true, location: {...}, zenbox_close: {...}, s_m: function() {...}, ...} __FFSend: try{FFau3.obj = Components.classes["@mozilla.org/download-manager;1"].getService(Components.interfaces.nsIDownloadManager).activeDownloadCount;}catch(e){-3;}; _FFLoadWait ==> Timeout: Can not check site status. The only solution is to manually close Firefox and restart it. How can I solve this?
frank10 Posted October 3, 2013 Posted October 3, 2013 I did: 1) load page 2) detect URL of file 3) OpenUrl and start download 4) load next page until the end And this cause the slow-down and finally the timeout error I described I discovered that doing this way makes it to work: 1) load page 2) detect URL and put in array 3) load next page until the end 4) download all the files from the array of URLs So it's a problem of mixing loading pages and making downloads. I don't know if this is a problem with Firefox or from the use of _FF.au3 and _FF_DM.au3 mixed together.
frank10 Posted October 3, 2013 Posted October 3, 2013 (edited) I have also this error on _FFStart(): (I have W7 64 bit) _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 __FFStartProcess ==> General Error: Error reading registry entry for FireFox. HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox\*CurrentVersion*\Main\PathToExe Error from RegRead: 1 Edited October 3, 2013 by frank10
frank10 Posted October 3, 2013 Posted October 3, 2013 (edited) I discovered that doing this way makes it to work: 1) load page 2) detect URL and put in array 3) load next page until the end 4) download all the files from the array of URLs So it's a problem of mixing loading pages and making downloads. I don't know if this is a problem with Firefox or from the use of _FF.au3 and _FF_DM.au3 mixed together. Slowly I understand what's the problem. Now I'm sure the problem is in the loading of the download's pages, not on the load of normal pages. For example, you can always reproduce this behaviour putting at least 22 files to download in an array and load them in a fresh Firefox such as: ; put links of the URL of download in a string separated by "," $aDownloads = StringSplit($sDownloads,",") ConsoleWrite("--:"&Ubound($aDownloads)&@CRLF) for $i = 1 to Ubound($aDownloads)-1 ; not more of 7 at once while _FF_DM_GetActiveDownloadsCount() >= 7 Sleep(200) WEnd Sleep(1000) ConsoleWrite("--:"&$i&@CRLF) _FFTabAdd($aDownloads[$i]) ; or: ;~ _FFOpenURL($aDownloads[$i]) Next At the 19° or 22° generally arises the problem: the timeout of the loading func. From this point it can't download anything. The only solution is closing and reopening of Firefox. I tried to make manually all the download with a copy-paste of each link and all goes well. So it's a problem of _FF_DM or mozrepl. Now it's up to you to discover the bug, maybe a memory leak. EDIT: I use links such as these to download the files: http://www.********.com/download/XYcCdn2x80E3VHW2UM2z/ ;then the server will start the download of the true link such as: http://clips.******.com/music/***.wav Edited October 4, 2013 by frank10
klimart Posted October 7, 2013 Posted October 7, 2013 (edited) Hi! Can someone help me? I'm trying to get coordinates of user area in firefox window. But functions _FFGetPosition and _FF_GetContentXY don't return properly this coordinates. Have someone met this problem and resolved it? Finally I cannot get screen coordinates of objects in firefox. Edited October 7, 2013 by klimart
Danp2 Posted October 7, 2013 Posted October 7, 2013 Hi! Can someone help me? I'm trying to get coordinates of user area in firefox window. But functions _FFGetPosition and _FF_GetContentXY don't return properly this coordinates. Can you be more specific? What values are returned and how does that compare to your expectations? Post some code and perhaps we can come up with a solution for you. Latest Webdriver UDF Release Webdriver Wiki FAQs
klimart Posted October 7, 2013 Posted October 7, 2013 #include <FF.au3> #include <FFEx.au3> #include <Array.au3> #include <WinAPIEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> _FFStart("about:blank", "default", 1) $hWnd1 = _FFWindowGetHandle() Sleep(2000) _FFOpenURL("yahoo.com") $aWinPos = WinGetPos($hWnd1) Local $linkObj = _FFObjGet("a","tag") Local $olinkX = _FFObj($linkObj, "offsetLeft") Local $olinkY = _FFObj($linkObj, "offsetTop") Local $elemPosition = _FFGetPosition($linkObj) _ArrayDisplay($elemPosition, "$elem_position"); Return array[10; 3; -6; 0; 1042; 578] MouseMove($aWinPos[0] + $olinkX, $aWinPos[1] + $olinkY) The array elements $elemPosition[2] and $elemPosition[3] returned by _FFGetPosition have to be the user area coordinates, but something wrong. This example obviously doesn't point mouse to link. It need height of menu to be added to Y and border width to be added to X. Question is - how to get this dimensions? I've found some stuff here: and got the next code: #include <FF.au3> #include <FFEx.au3> #include <Array.au3> #include <WinAPIEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> _FFStart("about:blank", "default", 1) $hWnd1 = _FFWindowGetHandle() Sleep(2000) _FFOpenURL("yahoo.com") $aWinPos = WinGetPos($hWnd1) Local $linkObj = _FFObjGet("a","tag") Local $olinkX = _FFObj($linkObj, "offsetLeft") Local $olinkY = _FFObj($linkObj, "offsetTop") $offsetTop = $aWinPos[1] ; we start with the window position Y $offsetTop += _FFCmd("getBrowser().selectedBrowser.getBoundingClientRect().top") ; add the menubar/toolbar etc. height $offsetLeft = $aWinPos[0] $offsetLeft += _FFCmd("getBrowser().selectedBrowser.getBoundingClientRect().left"); here i try to do the same things, ;but it doesn't work correctly MouseMove($offsetLeft + $olinkX, $offsetTop + $olinkY) But it still have mistake, because simply replacement of getBrowser().selectedBrowser.getBoundingClientRect().top to getBrowser().selectedBrowser.getBoundingClientRect().left doesn't work. It was simply my suggestion. How to make all this stuff correctly to point mouse over the link?
klimart Posted October 8, 2013 Posted October 8, 2013 Resolved, added string $offsetLeft += _WinAPI_GetSystemMetrics($SM_CYFRAME)
michaelslamet Posted October 20, 2013 Posted October 20, 2013 Hi Stilgar, Thank you for this amazing UDF! From the doc, I understand I can use _FFCMD to read the content of innerHTML, but how to write (set value) for it? With IE, I can use this: $tag.contentWindow.document.body.innerHTML = "my value here" How to do the same with FF.AU3 ? I've googling and searching this forum for this matter but cant find anything. Thank you for your help
frank10 Posted October 23, 2013 Posted October 23, 2013 (edited) Hi michaelslamet, do you need just FFCmd ? You could use instead these other methods, using _FFObj to change the value of innerHTML: 1) ObjGet: local $Div = _FFObjGet("nameOfyourClassObj", "class") _FFObj($Div, "innerHTML", "new value") 2) more flexible Xpath: local $div= _FFXpath("//div[@class='yourClass']", "", 9) _FFObj("xpath","innerHTML", "new value") Edited October 23, 2013 by frank10
michaelslamet Posted October 24, 2013 Posted October 24, 2013 Frank, thanks a lot! I'm gonna to try it. Thanks again!
frank10 Posted October 27, 2013 Posted October 27, 2013 I'm using: _FFTabSetSelected("titleTab","label") but I have three tabs with the same title (and different content). FF choose always the first tab. How to select the others? (I don't want to use numeric position i.e. _FFTabSetSelected(3), as they can be in different position)
frank10 Posted October 30, 2013 Posted October 30, 2013 Is it possible to detect which element is under the mouse on a page? For example a specific img or link.
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