Jump to content

_FFClick() always executes _FFLoadWait() !!!


Recommended Posts

Hey Everyone,

I got a Problem with the UDF FF.au3 by Thorsten Willert. I want to use _FFClick() to click on a button (which works just fine) but in the Time the page needs to load i would like to do other stuff in a different Firefox window.

Even though i used _FFClick("button", "id", 0, False) it always waits till the page is loaded before it continues to go on with the script.

Is there a way to get rid of this problem?

 

PS: I hope this is the right place to post this topic

Link to comment
Share on other sites

You can't do two things at the same time with AutoIt.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

You can't do two things at the same time with AutoIt.

I'm not really trying to do two things at the same time, I only want my script to go on without waiting for the page to load.

 

Can you post some sample code to demonstrate the issue? Also, what version of FF.au3 are you using?

 

My FF.au3 Version is 0.6.0.1b-7 (since 0.6.0.1b-3 has a Problem with _FFClick())

Here is Part of the Code:

Global $aInstanz[2]

_FFStart("www.google.com", "default", 1, False, "127.0.0.1", 4242)
$aInstanz[0] = $_FF_GLOBAL_SOCKET


_FFStart("www.yahoo.com", "default", 1, False, "127.0.0.1", 4242)
$aInstanz[1] = $_FF_GLOBAL_SOCKET


Func function1()
    $_FF_GLOBAL_SOCKET = $aInstanz[0]
    If _FFIsConnected() = 0 Then
        _FFConnect()
    EndIf
    _FFTabSetSelected("First Tab","label")
    WinActivate("First Tab - Mozilla Firefox")
    WinWaitActive("First Tab - Mozilla Firefox")
    _FFFormCheckBox("Checkbox", False, 0, "id", "form1", "name")
    _FFClick("button1", "id", 0, False)    ;This is part where it shouldn't wait till the page is loaded
    function2()
EndFunc

Func function2()
    $_FF_GLOBAL_SOCKET = $aInstanz[1]
    If _FFIsConnected() = 0 Then
        _FFConnect()
    EndIf
    _FFTabSetSelected("other Tab","label")
    WinActivate("other Window")
    WinWaitActive("other Window")
    _FFFrameEnter("Frame1", "id")
    _FFLinkClick("Strg + Q", "title")
    Send("{Enter}")
EndFunc

I changed the names of the ids and the Websites, because its workstuff and you couldn't acces the websites anyway. But accept for that this is the code I'm struggling with.

The Problem here is that in function1() I dont wont to wait for the page to load when I use _FFClick("button1", "id", 0, False) (its not relevant for the further process) and just click the Button and move on with function2()

I thought the last argument in _FFClick() which I set to False would do that, but for some reason it still waits for the page to load.

Edited by JimbowGT
Link to comment
Share on other sites

I noticed that you are using WinActivate and WinWaitActive. Can you explain why those are there?

FWIW, here's how I switch window's in FF:

If _FFWindowSelect('www.google.com', 'href', False) And _
  _FFTabSetSelected('www.google.com', 'href') Then
  *-- Do stuff here
Else
  *-- Error handling here
EndIf

Try running your script in SciTE and posting the results from the output window here.

Link to comment
Share on other sites

I use WinActivate und WinWaitActive because they do what i want them to do ;) they switch between the different Windows but i'll try your solution as well and see if its works better for my purposes.

If I run function1() Scite gives me this output:

__FFSend: try{FFau3 != null?1:0}catch(e){'_FFCmd_Err';};
__FFRecv: 1
_FFLoadWait: . loaded in 12ms
[object HTMLDocument] - {location: {...}, addEventListener: function() {...}, removeEventListener: function() {...}, dispatchEvent: function() {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, ...}
__FFSend: try{FFau3.SearchTab('Admin Tool R5')}catch(e){'_FFCmd_Err';};
__FFRecv: 0
__FFSend: try{gBrowser.tabContainer.selectedIndex = 0}catch(e){'_FFCmd_Err';};
__FFRecv: 0
__FFSend: FFau3.WCD=window.content.top.document;
__FFRecv: [object HTMLDocument] - {location: {...}, addEventListener: function() {...}, removeEventListener: function() {...}, dispatchEvent: function() {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, ...}
[object HTMLDocument] - {location: {...}, addEventListener: function() {...}, removeEventListener: function() {...}, dispatchEvent: function() {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, ...}
__FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//form[@name='formterminateabo']//input[@type='checkbox' and @id='noConfirmMail']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue.checked=false;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: 0
__FFSend: try{FFau3.simulateEvent(FFau3.WCD.getElementById('shopTerminateSubmit'),'MouseEvents','click');}catch(e){'_FFCmd_Err';};
__FFRecv: 1
__FFSend: FFau3.WCD=window.content.top.document;
__FFRecv: [object HTMLDocument] - {location: {...}, addEventListener: function() {...}, removeEventListener: function() {...}, dispatchEvent: function() {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, ...}
[object HTMLDocument] - {location: {...}, addEventListener: function() {...}, removeEventListener: function() {...}, dispatchEvent: function() {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, ...}
__FFSend: try{FFau3 != null?1:0}catch(e){'_FFCmd_Err';};
__FFRecv: 1
_FFLoadWait: . loaded in 13ms
[object HTMLDocument] - {getElementsByClassName: function() {...}, location: {...}, addEventListener: function() {...}, removeEventListener: function() {...}, dispatchEvent: function() {...}, getElementsByName: function() {...}, getItems: function() {...}, ...}
__FFSend: try{FFau3.SearchTab('novomind')}catch(e){'_FFCmd_Err';};
__FFRecv: 0
__FFSend: try{gBrowser.tabContainer.selectedIndex = 0}catch(e){'_FFCmd_Err';};
__FFRecv: 0
__FFSend: FFau3.WCD=window.content.top.document;
__FFRecv: [object HTMLDocument] - {getElementsByClassName: function() {...}, location: {...}, addEventListener: function() {...}, removeEventListener: function() {...}, dispatchEvent: function() {...}, getElementsByName: function() {...}, getItems: function() {...}, ...}
[object HTMLDocument] - {getElementsByClassName: function() {...}, location: {...}, addEventListener: function() {...}, removeEventListener: function() {...}, dispatchEvent: function() {...}, getElementsByName: function() {...}, getItems: function() {...}, ...}
__FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//a[contains(@title,'Strg + Q')]",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: - {toString: function() {...}, href: "", target: "", download: "", ping: "", rel: "", hreflang: "", ...}
__FFSend: try{FFau3.simulateEvent(FFau3.xpath,'MouseEvents','click');}catch(e){'_FFCmd_Err';};
__FFRecv: 1
_FFLoadWait: . loaded in 19ms
[object HTMLDocument] - {getElementsByClassName: function() {...}, location: {...}, addEventListener: function() {...}, removeEventListener: function() {...}, dispatchEvent: function() {...}, getElementsByName: function() {...}, getItems: function() {...}, ...}
Link to comment
Share on other sites

Problem lays in line 27 where it says: _FFLoadWait: . loaded in 13ms

This _FFLoadWait should not be there since i use the False Argument in _FFClick()

Edit: I just realized, that i don't need to switch the firefox windows at all, since I save the $_FF_GLOBAL_SOCKET and therefor can directly choose the window i want to control.

Edited by JimbowGT
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...