Jump to content

Recommended Posts

Posted (edited)

Thanks again.. for both stligar / PsaltyDS

I've slightly have to modify the script (exit instead of ExitLoop) and it's OK!!

If _FFConnect() Then
    While True
        If _FFSearch("migration") Then
            WinActivate("Firefox")
            WinSetOnTop("Firefox", "", 0)
            Exit
        Else
            _FFClick( _FFXPath("//a[contains(.,'Connexions')]", "", 9))
            ExitLoop
        EndIf
        Sleep(1000)
    Wend
EndIf

I think it take few hours for me too find that !!!

Great job!

The While\WEnd loop is still moot. Again, regardless of how _FFSearch() returns, either the loop or the entire script exits. So there can never be a second pass through the loop.

If that is really the behavior you want then it would just be:

If _FFConnect() Then
    If _FFSearch("migration") Then
        WinActivate("Firefox")
        WinSetOnTop("Firefox", "", 0)
        Exit
    Else
        _FFClick( _FFXPath("//a[contains(.,'Connexions')]", "", 9))
    EndIf
EndIf

^_^

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

The While\WEnd loop is still moot. Again, regardless of how _FFSearch() returns, either the loop or the entire script exits. So there can never be a second pass through the loop.

If that is really the behavior you want then it would just be:

If _FFConnect() Then
    If _FFSearch("migration") Then
        WinActivate("Firefox")
        WinSetOnTop("Firefox", "", 0)
        Exit
    Else
        _FFClick( _FFXPath("//a[contains(.,'Connexions')]", "", 9))
    EndIf
EndIf

^_^

Depending on the situation, if the page is changing it must be in a loop - that's how I understand the question.
Posted (edited)

I think there's a simple solution to this:

Make firefox run the javascript code in the link directly.

As in , make it type this into the address field(ctrl+l to shift focus to the address field):

java script:void(execute('connexionsList')) <--- remove white space between java and script

Should work, but it depends on what execute('connexionsList') does.

Edit: Whops skipped through the thread, but this should still be a quite simple solution to the first obstacle. ^_^

Edited by FreeFry
Posted (edited)

I think there's a simple solution to this:

Make firefox run the javascript code in the link directly.

As in , make it type this into the address field(ctrl+l to shift focus to the address field):

java script:void(execute('connexionsList'))

Should work, but it depends on what execute('connexionsList') does.

Edit: Whops skipped through the thread, but this should still be a quite simple solution to the first obstacle. ;)

^_^ depending on your FF prefs the only reaction from FF is a google error page with

"java script:void(execute('connexionsList'))" not found ...

[EDIT]

If you would do this you must type "java_script:void(execute('connexionsList'))

[EDIT]

OK a Javascript - link is doesn't displayed here - replace the _ with nothing.

Edited by Stilgar
Posted (edited)

The While\WEnd loop is still moot. Again, regardless of how _FFSearch() returns, either the loop or the entire script exits. So there can never be a second pass through the loop.

If that is really the behavior you want then it would just be:

If _FFConnect() Then
    If _FFSearch("migration") Then
        WinActivate("Firefox")
        WinSetOnTop("Firefox", "", 0)
        Exit
    Else
        _FFClick( _FFXPath("//a[contains(.,'Connexions')]", "", 9))
    EndIf
EndIf

^_^

The problem, in that case (and before i had to admit too..), is that the

_FFClick( _FFXPath("//a[contains(.,'Connexions')]", "", 9))

does not work at all..

I had to put has stilgar told me the line code like this:

_FFXPath("//a[contains(.,'Connexions')]", "", 9)
_FFClick("FFau3.xpath")

but, there's a "weird" problem with _FFLoadWait, is that the page is not totally loaded and the script continues..

I see that the system is "giving back the hand" to the system (the cursor is not waiting anymore..) but the page is not fully really loaded.. The point is that the "waiting" time is not always the same between each search... Is it possible to make the script wait until a certain sequence of characters appears in the window??

PS: PSaltyDS, you're code is functionning well too.. as i "adapt" it with

_FFXPath("//a[contains(.,'Connexions')]", "", 9)
_FFClick("FFau3.xpath")

Just one thing.. after tested it few times, it appears that it's not working all the time.. strange..

this is what the log windows from Scite gaves me after that the "Connexions" was not clicked on..

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 1
_FFConnect: AutoIt: 3.3.0.0
_FFConnect: FF.au3: 0.5.2.0b-1
_FFConnect: IP: 127.0.0.1
_FFConnect: Port:   4242
_FFConnect: Delay:  2ms
_FFConnect: Socket:     1764
_FFConnect: Browser:    Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.7
__FFSend: try{content.find("migration", false, false, true, false, true, false);}catch(e){"_FFSearch_Err";}
__FFRecv: 0
_FFSearch ==> No match: migration
__FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.frames["top"].document.evaluate("//a[contains(.,'Connexions')]",content.document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: 
__FFSend: try{FFau3.SimulateClick(FFau3.xpath,0,0);}catch(e){'_FFCmd_Err';};
__FFRecv: 0
>Exit code: 0   Time: 4.579

2 times it does not work, then it's been ok for the 3rd.. it returns me:

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 1
_FFConnect: AutoIt: 3.3.0.0
_FFConnect: FF.au3: 0.5.2.0b-1
_FFConnect: IP: 127.0.0.1
_FFConnect: Port:   4242
_FFConnect: Delay:  2ms
_FFConnect: Socket:     1768
_FFConnect: Browser:    Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.7
__FFSend: try{content.find("migration", false, false, true, false, true, false);}catch(e){"_FFSearch_Err";}
__FFRecv: 0
_FFSearch ==> No match: migration
__FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.frames["top"].document.evaluate("//a[contains(.,'Connexions')]",content.document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: â {href: ""}
__FFSend: try{FFau3.SimulateClick(FFau3.xpath,0,0);}catch(e){'_FFCmd_Err';};
__FFRecv: 1
>Exit code: 0   Time: 4.030

Thanks..

Edited by mjoly
Posted (edited)

@mjoly:

This:

_FFClick( _FFXPath("//a[contains(.,'Connexions')]", "", 9))

is only working since V0.5.3.0, you have V0.5.2.0b-1.

_FFLoadWait checks the nsIWebProgress-interface from mozilla if the page is loaded and if the browser is busy.

Can you show me the page where this problem appears, please?

Then I can check the "no clicking" problem, too. or isn't the page fully loaded at this moment, you can see at this lines:

try{FFau3.xpath=window.content.frames["top"].document.evaluate("//a[contains(.,'Connexions')]",content.document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv:

that nothing is received, so there is nothing to click on.

Edited by Stilgar
Posted (edited)

@mjoly:

This:

_FFClick( _FFXPath("//a[contains(.,'Connexions')]", "", 9))

is only working since V0.5.3.0, you have V0.5.2.0b-1.

_FFLoadWait checks the nsIWebProgress-interface from mozilla if the page is loaded and if the browser is busy.

Can you show me the page where this problem appears, please?

Then I can check the "no clicking" problem, too. or isn't the page fully loaded at this moment, you can see at this lines:

try{FFau3.xpath=window.content.frames["top"].document.evaluate("//a[contains(.,'Connexions')]",content.document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv:

that nothing is received, so there is nothing to click on.

So,

I've tried with the last version of FF.au3 (0.5.3.2b-10) and the debugging windows gave me:

_FFSearch ==> No match: $sSearchString: Login
_FFLoadWait: .d:\apps\AutoIT\install\Include\FF.au3 (2278) : ==> Variable used without being declared.:
$sRet = __FFRecv($iTimeOut)
^ ERROR

So it stop before it done something in the page i want to test..

it seems that the problem is coming from the way i use the _ffloadwait () ?? nor from FF.au3?

still, for _ffloadwait as it was working before this version, there war no more really problems, it seems that i've mixed some commands in the sequence on what they've supposed to be send.. so, at this time, no more trouble about that.. (expect the fact that no..it's no longer working at this moment !!) :-)

Thanks.

PS: it seems that in the line 2278 was looking in FF.au3 is like this:

$sRet = __FFRecv($iTimeOut)

it was missing only this to work..

Local $sRet = __FFRecv($iTimeOut)

now.. it's works again!

Edited by mjoly

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
×
×
  • Create New...