Jump to content

FF.au3 (V0.6.0.1b-10)


Stilgar
 Share

Recommended Posts

I've the HTML script like this :

<tr valign="center"><td width="100%">
                  <div id="div__4668003_0">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                  <tr>
                      <td valign="middle" width="5%">
                      <input name="cg__4668003" type="radio"
                      
                        value="0" />
                    </td>
                    <td class="radiolist" width="95%">
                        <span class="style4668003">Yes</span>
                    </td>
                  </tr>
                </table>
                </div>
            </td></tr>

Plz, Help me use _FFFormRadioButton for this .

And Use _FFFormCheckBox for that one .

<tr valign="center"><td width="100%">
                  <div id="div__4668004_0">
                  <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                      <td valign="middle" width="5">
                        <input name="cg__4668004" type="checkbox"
                        
                          value="1"
                          />
                      </td>
                      <td class="checklist" width="275">
                        <span class="style4668004">Adhesive Bandages</span>
                      </td>
                    </tr>
                  </table>
                  </div>
                </td></tr>

Thx

Because I can't see any form-tag there I give you some examples with _FFXpath:

;The radio-button:
_FFXpath("//input[@name='cg__4668003']", "checked=true", 9)
;The check-box:
_FFXpath("//input[@name='cg__4668004']", "checked=true", 9)
Link to comment
Share on other sites

  • 2 weeks later...

I noticed a problem with _FFFrameEnter while upgrading from V0.5.3.7b to 0.6.0.0b-5.

I had to change this statement:

_FFFrameEnter("main", "id")

to:

_FFFrameEnter(2)

to make subsequent things work.

Is this a problem with the newer version?

Here are the console logs:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Frank\Script\Firefox\ff-factory.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>08:42:02 Starting AutoIt3Wrapper v.2.0.0.3 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86)

>Running AU3Check (1.54.19.0) from:C:\Program Files\AutoIt3

+>08:42:02 AU3Check ended.rc:0

>Running:(3.3.2.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Frank\Script\Firefox\ff-factory.au3"

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3

_FFConnect: AutoIt: 3.3.2.0

_FFConnect: FF.au3: 0.5.3.7b

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 1660

__FFSend: try{window.content.frames["top"].document.browserDOMWindow}catch(e){'_FFCmd_Err';};

__FFRecv:

__FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';};

__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)

_FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)

__FFSend: try{content.frames.length}catch(e){'_FFCmd_Err';};

__FFRecv: 3

__FFSend: try{content.frames[0].name}catch(e){'_FFCmd_Err';};

__FFRecv: banner

__FFSend: try{content.frames[1].name}catch(e){'_FFCmd_Err';};

__FFRecv: contents

__FFSend: try{content.frames[2].name}catch(e){'_FFCmd_Err';};

__FFRecv: main

@@ Debug(518) : $i = 2

>Error code: 0

_FFOpenURL: BpclView.ssi

__FFSend: try{window.content.frames[2].document.location.href="BpclView.ssi";}catch(e){'_FFCmd_Err';};

__FFRecv: BpclView.ssi

_FFLoadWait: .... loaded in 874ms

@@ Debug(523) : 1 = 1

>Error code: 0

_FFLoadWait: . loaded in 31ms

__FFSend: try{FFau3.simulateClick(window.content.frames[2].document.getElementById('Modify'),0,0);}catch(e){'_FFCmd_Err';};

__FFRecv: 1

_FFLoadWait: .... loaded in 949ms

__FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.frames[2].document.evaluate("//form[@name='Form1']//select[@id='BpclPortList']//option[@value='7']",window.content.frames[2].document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue.selected=true;}catch(e){'_FFXPath_Error: '+e;};

__FFRecv: 1

__FFSend: try{window.content.wrappedJSObject.frames[2].document.getElementById('BpclPercentage').value='77';}catch(e){'_FFCmd_Err';};

__FFRecv: 77

__FFSend: try{window.content.frames[2].document.forms[1].elements.length;}catch(e){'_FFCmd_Err';};

__FFRecv: 7

__FFSend: try{window.content.frames[2].document.forms[1].submit();}catch(e){'_FFCmd_Err';};

__FFRecv:

_FFLoadWait: .... loaded in 875ms

_FFLoadWait: . loaded in 32ms

+>08:42:09 AutoIT3.exe ended.rc:0

+>08:42:10 AutoIt3Wrapper Finished

>Exit code: 0 Time: 8.381

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Frank\Script\Firefox\ff-factory.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>08:44:11 Starting AutoIt3Wrapper v.2.0.0.3 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86)

>Running AU3Check (1.54.19.0) from:C:\Program Files\AutoIt3

+>08:44:11 AU3Check ended.rc:0

>Running:(3.3.2.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Frank\Script\Firefox\ff-factory.au3"

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3

_FFConnect: AutoIt: 3.3.2.0

_FFConnect: FF.au3: 0.6.0.0b-5

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 1660

__FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';};

__FFRecv:

__FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';};

__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)

_FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)

__FFSendJavascripts: Sending functions to FireFox .......... done

@@ Debug(518) : $i = 1

>Error code: 0

_FFOpenURL: BpclView.ssi

__FFSend: try{window.content.top.main.document.location.href="BpclView.ssi";}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

@@ Debug(523) : 1 = 1

>Error code: 8

_FFLoadWait: ._FFOpenURL ==> No match: BpclView.ssi

loaded in 31ms

__FFSend: try{FFau3.simulateEvent(window.content.top.main.document.getElementById('Modify'),'MouseEvents','click');}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFClick ==> No match: $sElement: window.content.document.getElementById('Modify')

+>08:44:14 AutoIT3.exe ended.rc:0

+>08:44:15 AutoIt3Wrapper Finished

>Exit code: 0 Time: 4.945

Frank

Link to comment
Share on other sites

I have tried to use _FFClick and _FFFormSubmit to submit this form (below) without success. Any suggestions? This page is within a frame, and I am using version 0.5.3.7b.

<html>

<head>

<title>BpclMod.htm</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="author" content="ics#cap">

<meta name="rev_author" content="ics#cap">

<meta http-equiv="pragma" content="NO-CACHE">

<meta http-equiv="expires" content="-1">

<meta name="alternate_title" content="BpclMod">

<link href="style.css" rel="stylesheet" type="text/css">

<style type="text/css"></style>

<script language="javascript">

function PortChanged()

{

var nPortNumber = parseInt(document.getElementById('BpclPortList').value, 10);

document.getElementById('PortNumber').value = nPortNumber;

document.Form1.submit();

UpdatePage();

}

function UpdatePage()

{

var start = new Date().getTime();

var cur = start;

while (cur - start < 50)

cur = new Date().getTime();

window.location.replace("BpclMod.ssi");

}

function Validate_Fields()

{

var nPercent = document.Form1.BpclPercentage;

if (!top.Validate_Number(nPercent, 0, 100))

return false;

return true;

}

</script>

</head>

<body onload="top.FixTable(document.getElementById('Table1'))">

<form id="PageHeader"><p class=nth1>Fault:&nbsp;&nbsp;Low voltage on power supply V1.<br></p></form>

<form name="Form1" id="Form1" method="post" onsubmit="return Validate_Fields();" action="System_Cmd">

<center>

<h2>Broadcast Packet Count Limit Configuration</h2>

<table id="Table1" border="2" cellspacing="0" cellpadding="4">

<tr>

<td class="LabelTop">Port Name</td>

<td valign="top" class="Value"><select name="BpclPortList" id="BpclPortList" onchange="PortChanged()"><option value=1>TX1</option><option value=2>TX2</option><option value=3>TX3</option><option value=4>TX4</option><option value=5 selected>TX5</option><option value=6>TX6</option><option value=7>FX1</option><option value=8>FX2</option><option value=100>All</option></select></td>

</tr>

<tr>

<td class="LabelTop">BPCL Percentage</td>

<td valign="top" class="Value"><input type="text" id="BpclPercentage" name="BpclPercentage" maxlength="3" size="3" value="3"</td>

</tr>

</table>

<br>

<input type="submit" id="Update" name="Update" value="Update"> <input type="button" value="Cancel" id="Cancel" name="Cancel" onclick="location=document.Form1.Destination.value">

<input type="hidden" id="ID" name="ID" value="Update_BpclConfig"> <input type="hidden" id="Destination" name="Destination" value="BpclView.ssi">

<input type="hidden" id="PortNumber" name="PortNumber" value="0">

</center>

</form>

<form id="PageFooter" name="PageFooter"><hr><p class=ntf1><strong>NOTE:&nbsp;&nbsp;</strong>Changes have been made that have not been <a href="Config.ssi" target=main>saved</a>.</p></form>

</body>

</html>

Frank

Link to comment
Share on other sites

I want to block cookies on some site, but i dont know how. I try to open FFex.au3 and see this function

Func _FF_EmptyCookies()
    _FFCmd('Components.classes["@mozilla.org/cookiemanager;1"].getService(Components.interfaces.nsICookieManager).removeAll();')
    If Not @error Then Return 1
    Return 0
EndFunc   ;==>_FF_EmptyCookies

Please help me make a function to block and allow cookie on site:

Ex: _FF_BlockCookies($site) and _FF_AllowCookies($site)

Link to comment
Share on other sites

What happened to the _FFLoadWaitTimeOut Function..??

It seems to have been removed since the last version I was using to the latest version that I just updated to --> FF.au3 (V0.6.0.0b)..??

Is there a different way now to set the GLOBAL LOADWAIT_TIMEOUT..?? Or am I missing something..??

Func _FFLoadWaitTimeOut($iTimeOut = 120000)
    If Not IsInt($iTimeOut) Then Return 0
    If $iTimeOut < 1000 Then $iTimeOut = 1000
    $_FF_LOADWAIT_TIMEOUT = $iTimeOut
    Return 1
EndFunc   ;==>_FFLoadWaitTimeOut

Also how can I click a button by its value..??

<input class="button" type="submit" value="Log in"/>

Also is there any FF Function to ScrollIntoView an Element at all..?? like there is for ScrollIntoView()..??

Edited by cypher175
Link to comment
Share on other sites

@fspafford:

I try this the next time ...

@vietnam929:

The solution is there:

http://www.autoitscript.com/forum/index.php?showtopic=107769

and now in the FFEx.au3, too.

@cypher175:

The function _FFLoadWaitTimeOut was removed.

Yes, there is a way to set this variable:

$_FF_LOADWAIT_TIMEOUT = $iYourTimeOutTime

;)

Or

_FFAu3Option("LoadWaitTimeOut", $iYourTimeOutTime)

Click on this ...

<input class="button" type="submit" value="Log in"/>

with:

_FFClick( _FFXPath("//input[@value='Log in']", "", 9 ))

or you use _FFFormSubmit instead.

Edited by Stilgar
Link to comment
Share on other sites

  • 2 weeks later...

Hi. Im have problems with tab functions. _FFTabExists(), _FFTabSetSelected() dont work with cyrillic text like _FFTabExists("тест"), return value is always -1. What im doing wrong :D ?

The tab-title is searched by regex. So you must use the escaped chars or this:

_FFTabExists(__FFValue2Javascript("тест") )
Link to comment
Share on other sites

@garynueman:

Thank you!

Update:

some new function for the FFex.au3:

; _FF_CookiesAllow

; _FF_CookiesDeny

; _FF_CookiesRemoveAll

; _FF_CookiesSetAccess

; _FF_GetStatus

; _FF_ResetTitle

; _FF_TabGetAllTitles

; _FF_TabGetAllURLs

; _FF_TabReloadAll

- _FF_Call: for "content.wrappedJSObject" you can use now "CW" as shortcut.

look at the UDF for more informations, please.

Edited by Stilgar
Link to comment
Share on other sites

_FFWindowSelect currently only looks at the active tab when searching by url. I changed the javascript code for SelectWin() to the following to allow selection of a window by searching all of the available urls:

; SelectWin()
    $sJavascript = 'FFau3.SelectWin = function SelectWin(sSearch,sMode,sType){'
    $sJavascript &= 'var win;var enum = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getEnumerator(sType);'
    $sJavascript &= 'while(enum.hasMoreElements() ){'
    $sJavascript &= 'win=enum.getNext();'
    $sJavascript &= 'switch(sMode){'
    $sJavascript &= 'case "title": if (win.title.indexOf(sSearch) != -1){repl.enter(win);return 1;};break;'
    $sJavascript &= 'case "label": if (FFau3.SearchTab(sSearch)>-1){repl.enter(win);return 1;};break;'
;   $sJavascript &= 'case "href": if (win.content.document.location.href.indexOf(sSearch) != -1){repl.enter(win);return 1;};break;'
    $sJavascript &= 'case "href": '
    $sJavascript &= 'var tabbrowser = win.gBrowser;'
    $sJavascript &= 'var numTabs = tabbrowser.browsers.length;'
    $sJavascript &= 'for (var index = 0; index < numTabs; index++ ){'
    $sJavascript &= 'var currentBrowser = tabbrowser.getBrowserAtIndex(index);'
    $sJavascript &= 'if (RegExp(sSearch).test(currentBrowser.currentURI.spec)){repl.enter(currentBrowser);return 1;}};break;'
    $sJavascript &= 'default: return -1};'
    $sJavascript &= '}return -1;};'

With this in mind, is it possible to send commands to a tab that is not currently selected?

Link to comment
Share on other sites

Need help!

_FFLinkClick is not working for me. Here is a small piece of code

$ww = _FFStart("www.google.com")

_FFSetValue("Mark Matthews","q","name")

Sleep(2000)

_FFClick("btnG", "name")

Sleep(2000)

_FFLinkClick("Mark Matthews' Blog", "text")

the search page shows up. but the _FFLinkClick does not work. gives this error -

__FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//a[contains(.,'Mark Matthews' Blog')]",FFau3.WCD,null,9,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};

__FFRecv: _FFXPath_Error: [Exception... "The expression is not a legal expression." code: "51" nsresult: "0x805b0033 (NS_ERROR_DOM_INVALID_Expression_ERR)" location: "chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/choudhary/Application%20Data/Mozilla/Firefox/Profiles/e32t8aiw.default/mozrepl.tmp.js Line: 1"]

_FFXPath ==> Invalid Expression: NS_ERROR_DOM_INVALID_Expression_ERR $sQuery: //a[contains(.,'Mark Matthews' Blog')]

__FFSend: try{FFau3.simulateEvent(0,'MouseEvents','click');}catch(e){'_FFCmd_Err';};

__FFRecv: -3

_FFClick ==> No match: $sElement: 0

Link to comment
Share on other sites

@DanP2:

Thank you for your suggestion!

Something like this was planned for _FFWindowSelect and _FFTabSetSelected for the next version.

With this in mind, is it possible to send commands to a tab that is not currently selected?

Not directly, but you can execute any Javascript on not selected tabs with:

$Result = _FFCmd("gBrowser.mTabs[n].FunctionOrAttribute")

Need help!

_FFLinkClick is not working for me. Here is a small piece of code

$ww = _FFStart("www.google.com")

_FFSetValue("Mark Matthews","q","name")

Sleep(2000)

_FFClick("btnG", "name")

Sleep(2000)

_FFLinkClick("Mark Matthews' Blog", "text")

the search page shows up. but the _FFLinkClick does not work. gives this error -

__FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//a[contains(.,'Mark Matthews' Blog')]",FFau3.WCD,null,9,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};

__FFRecv: _FFXPath_Error: [Exception... "The expression is not a legal expression." code: "51" nsresult: "0x805b0033 (NS_ERROR_DOM_INVALID_Expression_ERR)" location: "chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/choudhary/Application%20Data/Mozilla/Firefox/Profiles/e32t8aiw.default/mozrepl.tmp.js Line: 1"]

_FFXPath ==> Invalid Expression: NS_ERROR_DOM_INVALID_Expression_ERR $sQuery: //a[contains(.,'Mark Matthews' Blog')]

__FFSend: try{FFau3.simulateEvent(0,'MouseEvents','click');}catch(e){'_FFCmd_Err';};

__FFRecv: -3

_FFClick ==> No match: $sElement: 0

That's a bug.

The problem is the ' in your search-text.

But you can avoid this by searching only the begin of the string - _FFLinkClick is searching substrings:

_FFLinkClick("Mark Matthews", "text")
Link to comment
Share on other sites

@DanP2:

Thank you for your suggestion!

Something like this was planned for _FFWindowSelect and _FFTabSetSelected for the next version.

Not directly, but you can execute any Javascript on not selected tabs with:

$Result = _FFCmd("gBrowser.mTabs[n].FunctionOrAttribute")

Is this a limitation of FF? MozRepl? Or your specific Autoit implementation?

It sure would be nice to be able to interact with a specific tab without needing to activate it first (like in IE).

Link to comment
Share on other sites

How can I do this without it prefixing "http://" to it..??

_FFOpenURL('javascript:alert("ALERT")')

Just include the FFEx.au3 and try this:

_FF_Call("alert('ALERT')")

@morawcik

Hi, It is possible to use two scripts in two different tabs at once?

At the moment only direct with Javascript:

_FFCmd("gBrowser.mTabs[n].FunctionOrAttribute")

But it's better to open for every script a new window.

Edited by Stilgar
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...