Jump to content

Recommended Posts

Posted (edited)

Hello,

Im working on another Automation task with FF udf

I need to click on a Button that does not have an ID assigned

The label on the Button is Search , and it calles a Java function.

I have tried using the java wrapper call function ( FFCmd("content.wrappedJSObject.search(document.forms[0])")) ,

but  that did not work.

How would I go about doing this ?

I have place a copy of the HTML below

Thanks

Paul

 

 

<form method="post">
<input name="searchMethod" type="hidden" value="search_selectuser"><input name="searchType" type="hidden" value="portaluserSelect"><input name="searchStyle" type="hidden" value="portaluserSelect"><input name="embedded" type="hidden" value="false"><input name="offset" type="hidden" value="0"><input name="increment" type="hidden" value="20"><input value="false" name="newwindow" type="hidden"><input name="searchFilter" type="hidden" value=""><input name="assignToElement" type="hidden" value="uid"><input name="popup" type="hidden" value="true">
<div class="content">
<h3>User Search Results</h3>
<em>** Remember, when using the User ID search, that this is an exact match search.  If you do NOT know the User ID exactly, please use the Last Name search.</em>
<table class="searchTable">
<tr>
<th>Search By:</th><td><input onfocus="selectuserRB(this.form,'uid');clearSearchEmailAddr(this.form);clearSearchUserName(this.form)" value="uid" name="userRB" class="inputnoborder" type="radio"></td><td align="left">User ID:</td><td colspan="4"><input onfocus="selectuserRB(this.form,'uid');clearSearchUserName(this.form);clearSearchEmailAddr(this.form)" size="60" name="searchuid"></td>
</tr>
<tr>
<td>&nbsp;</td><td><input onfocus="selectuserRB(this.form,'emailaddr');clearSearchUID(this.form);clearSearchUserName(this.form)" value="emailaddr" name="userRB" class="inputnoborder" type="radio"></td><td align="left">Email Address:</td><td colspan="4"><input onfocus="selectuserRB(this.form,'emailaddr');clearSearchUID(this.form);clearSearchUserName(this.form)" size="60" name="mail"></td>
</tr>
<tr>
<td>&nbsp;</td><td><input onclick="clearSearchUID(this.form);clearSearchEmailAddr(this.form);" value="username" name="userRB" class="inputnoborder" type="radio" checked></td><td align="left">Last Name:</td><td><input onfocus="selectuserRB(this.form,'username');clearSearchUID(this.form);clearSearchEmailAddr(this.form);" size="20" name="sn"></td><td>&nbsp;</td><td align="right">First Name:</td><td><input onfocus="selectuserRB(this.form,'username');clearSearchUID(this.form);clearSearchEmailAddr(this.form);" size="20" name="givenname"></td>
</tr>
<tr>
<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td align="right"><em>exact match:&nbsp;</em><input class="inputnoborder" value="EMsn" name="EMsn" type="checkbox"></td><td>&nbsp;</td><td>&nbsp;</td><td align="right"><em>exact match:&nbsp;</em><input class="inputnoborder" value="EMgivenname" name="EMgivenname" type="checkbox"></td>
</tr>
</table>
<div class="actionsRow">
<a class="cssbutton" href="javascript:search(document.forms[0])">
  Search
  </a>
</div>
<table class="resultsTable">
<thead>
<tr>
<th>Select</th><th>User Name</th><th>User ID</th><th>Company</th><th>Status</th><th>Relationship</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</form>
</body>
</html>
 

Edited by HighlanderSword
Posted

hello, i usually use the firefox inspector, and its seems to retrieve clearer code.

Having some problems too in my code, sometimes it works, other times won't.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

Got this code:

<a id="skip_button" target="_top"
style="position: absolute; width: 300px; text-align: right; height: 30px; top: 10px; right: 20px; color: rgb(255, 255, 255); font-weight: bold; font-size: 16px;"
href="http://go4up.com/dl/1mcu1eqhLRd4">
<img id="skip_ad_button" height="39" alt="Skip Ad" src="http://cdn.adf.ly/static/image/skip_ad/en.png"></img>
</a>

how do i check if skip_ad_button has appeared, in order to click it?

Or even better would be to use the link above that.

Here's what i got:

Do
$PE = ProcessExists('firefox.exe')
    If $PE <> 0 Then
        _FFIsConnected()
        If @error Then
            _FFConnect()
        EndIf
    EndIf
    Sleep(500)
    ;_FFClick('skip_button', 'id')
    ;_FFImageClick('skip_ad_button', "id", False)
    Check()
Until $PE = 1234567890

    Func Check()
        ;$Val = _FFGetValue('skip_button', 'id')
        $Val = _FFObjGet('skip_button', 'id')
        If $Val = '' Then
            ConsoleWrite($Val&' Skip Button Not Found' & @CRLF)
            Check()
        Else
            ConsoleWrite('Legit!' & @CRLF)
            _FFImageClick('skip_button', "id", False)
            _FFClick('skip_button', 'id')
        EndIf
    EndFunc
  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

  • 3 weeks later...
Posted

Sorry for my noobness, I'm new to this. I am using the FF.au3 version that has the download link on the first page (0.6.0.1b-3). Is that the last version?

I'm running this on FF 22 with MozRepl 1.1.2. When I call 

$started=_FFStart("www.startpage.com")

 it opens two FF windows, one with the page I requested and another with the port written on the address bar and "Unable to connect. Firefox can't establish a connection to the server at 4242.". Alas, @error is set to 0, function returns 1, and there seems to be no error reported in the debug:

__FFStartProcess: ""C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -new-window "http://www.startpage.com"  -repl 4242 
_FFConnect: OS: WIN_2008R2 WIN32_NT 7601 Service Pack 1
_FFConnect: AutoIt: 3.3.8.1
_FFConnect: FF.au3: 0.6.0.1b-3
_FFConnect: IP: 127.0.0.1
_FFConnect: Port: 4242
_FFConnect: Delay:  2ms
_FFConnect: Socket:  512
_FFConnect: Browser: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
__FFSendJavaScripts: Sending functions to FireFox .......... done
_FFLoadWait: . loaded in 11ms
 
Did I do everything ok ? Is this intended behaviour ?
 
Posted
  On 7/29/2013 at 4:13 PM, DanP2 said:

There are newer versions posted later in this thread where that issue is resolved.

Thanks man, I put V0.6.0.1b-8 and I don't have that bug anymore.

Posted

Is there a way to download the MozRepl as a separate XPI file ? (I wanna keep separate copies of FF, MozRepl and FF.au3...,so that if something is not gonna work or be available in the future I have copies for stuff that works)

  • 4 weeks later...
Posted (edited)

Hi, could you tell me, how to select a FF window WITH PROFILE?

I tried to do something like this:

#include "FF.au3"

_FFstart("www.google.com","1",9)
_FFWIndowSelect()
_FFOpenURL('www.wp.pl')
 

with already opened any other FF window

.

 'www.wp.pl' url opens in first opened window. How to force my window (google.com in this case) to be selected? I MUST work with profiles

Included Output:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\Program Files\AutoIt3\testWielowatkowy.au3" /UserParams    
+>23:16:28 Starting AutoIt3Wrapper v.2.1.0.33    Environment(Language:0415  Keyboard:00000415  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (1.54.22.0)  from:C:\Program Files (x86)\AutoIt3
+>23:16:28 AU3Check ended.rc:0
>Running:(3.3.8.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "D:\Program Files\AutoIt3\testWielowatkowy.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
__FFStartProcess: ""D:\Program Files (x86)\Mozilla Firefox\firefox.exe" -new-window "http://www.onet.pl" -no-remote "-repl 4242"  -P "1"
_FFConnect: OS: WIN_7 WIN32_NT 7601 Service Pack 1
_FFConnect: AutoIt: 3.3.8.1
_FFConnect: FF.au3: 0.6.0.1b-7
_FFConnect: IP: 127.0.0.1
_FFConnect: Port:   4242
_FFConnect: Delay:  2ms
_FFConnect: Socket:     664
_FFConnect: Browser:    Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0
__FFSendJavaScripts: Sending functions to FireFox .......... done
_FFLoadWait: . loaded in 10ms
[object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
__FFSend: try{repl.enter(Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser"))}catch(e){'_FFCmd_Err';};
__FFRecv: [object ChromeWindow] - {0: {...}, 1: {...}, 2: {...}, 3: {...}, 4: {...}, 5: {...}, 6: {...}, ...}
__FFSend: try{FFau3.tmp=document.title;document.title='FFAU31105889534'}catch(e){'_FFCmd_Err';};
__FFRecv: FFAU31105889534
__FFSend: try{document.title=FFau3.tmp}catch(e){'_FFCmd_Err';};
__FFRecv: 2 : Wirtualna Polska - www.wp.pl - Mozilla Firefox
_FFWindowGetHandle: 
_FFOpenURL: http://www.wp.pl
__FFSend: try{window.content.top.document.location.href='http://www.wp.pl'}catch(e){'_FFCmd_Err';};
_FFWindowGetHandle ==> General Error
__FFRecv: http://www.wp.pl
_FFLoadWait: ....... loaded in 1680ms
[object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
__FFSend: FFau3.WCD=window.content.top.document;
__FFRecv: [object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
[object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
+>23:16:35 AutoIT3.exe ended.rc:0
>Exit code: 0    Time: 8.180

I asked EVERYONE and work with it 5 weeks. Any help?

Edited by zbigj
Posted

General answer i think would be winactivate, but i don't quite get what you mean with profiles, i think i do,

you can be talking about firefox profiles, and i know you can select the one to use at start,

but i don't think you can use different profiles in different windows.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

Thanks to firefox profiles I can have separate FF windows with separate cookies, tabs and so on. And when I run Firefox with option -no-remote (firefox.exe -P profileName -no-remote) then I can use many windows with different profiles in the same time. _FFStart(url, nameOfProfile, 9) is made for profiles - 9 =1+8, 1 is for new window and 8 is to include -no-remote switch.

Winactivate will make my window active, and perhaps (I don't know) make a focus with that window, but I want to concentrate FF.au3 on that window, I mean every next  _FF function will operat on this window. Generally _FFWindowSelect(title or url) is for that purpose, but it doesn't work with _FFStart(...,nameOfProfile,..) I tried to debug output, but I'm just medium autoit programmer and didn't master Javascript and MozRepl yet.

Posted

hmm i see, have you tried to reconnect? Maybe if you reconnect it will focus in there.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

  • 4 weeks later...
Posted (edited)

Updated test-version to: V0.6.0.1b-9:

http://thorsten-willert.de/Themen/FFau3/Testversion/FF%20V0.6.0.1b-9.au3

V0.6.0.1b-9
- Added: __FFStartProcess: 64bit support
- Added: __FFIsURL: support for intranet
- Changed: _FFQuit now closes FireFox with multiple windows
- Fixed: Connection-limit to MozRepl

V0.6.0.1b-8 (by Danp2)
- Changed: _FFTabExists to allow search by href
- Changed: _FFTabSetSelected to allow selection by href
- Changed: SelectWin to check individual tabs
- Added: FFau3.SearchTabURL helper function
- Fixed: __FFStartProcess (4242 port error)
- Fixed: _FFGetPosition
http://thorsten-willert.de/Themen/FFau3/Testversion/FF.changelog.txt Edited by Stilgar
Posted
  On 9/14/2013 at 12:59 PM, Stilgar said:

Updated test-version to: V0.6.0.1b-9:

 

Download functions not included? (especially to start download)

Any hope for new help file with examples?

Posted (edited)
  On 9/15/2013 at 8:39 AM, Iczer said:

Download functions not included? (especially to start download)

Any hope for new help file with examples?

 

There's an UDF(_FF_DM.au3) for the FireFox-Downloadmanager:

http://thorsten-willert.de/Themen/FFau3/FF_AddOns_UDFs/files

To start a download you can click on the download link (_FFClick)

An updated for the help file is in work.

Edited by Stilgar
Posted

Thank you, is it possible to embedded FF like IE as in the old versions of Firefox? the say in the website that they stpopped supporting mozilla firefox activex control, and this project was doing great before it stops too.

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

Posted (edited)
  On 9/15/2013 at 1:50 PM, EKY32 said:

Thank you, is it possible to embedded FF like IE as in the old versions of Firefox? the say in the website that they stpopped supporting mozilla firefox activex control, and this project was doing great before it stops too.

 

No, It's not possible to embed FF and there's no working activex control.

But you can look at this example ((quick-and-dirty hack):

Embedded FireFox

Edited by Stilgar
Posted (edited)
  On 9/15/2013 at 2:10 PM, Stilgar said:

No, It's not possible to embed FF and there's no working activex control.

But you can look at this example ((quick-and-dirty hack):

Embedded FireFox

 

Well thank you,

Didn't work on Win XP, and on Win 7 x64 it made th system freeze until i closed the process.

No errors,

Last AutoIt Release.

Edited by EKY32

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

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
  • Recently Browsing   0 members

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