Jump to content
Sign in to follow this  
Arclite86

How do I get this element with FF

Recommended Posts

Arclite86

the input/element code

<input type="text" name="signin[username]" class="shadow_input biginput lightgray" title="you@example.com" id="signin_username">

i have tried this but it doesn't work

#include <FF.au3>
#include <FFEx.au3>

Local $oFF = _FFStart("http://tweepi.com/auth/login")

Local $username = _FFGetValueById ($oFF,"signin_username")
_FFSetValue($username, "cdadadajhj")
Edited by Arclite86

Share this post


Link to post
Share on other sites
Arclite86

 

You should be able to do this with _FFXPath, something like:

_FFXPath("//form//input[@name='signin[username]']")
_FFCmd("FFau3.xpath.value='cdadadajhj'")

it did work but it is kinda slow (wait 3-5 sec), is there a quicker way?

and can somebody please explane how this code works.

Edited by Arclite86

Share this post


Link to post
Share on other sites
Danp2

What you are experiencing is the initial delay where the function _FFConnect is establishing the connection to MozRepl. This should only occur once when you initiate the script.

The actual call to _FFXpath and _FFCmd runs very quickly. You can confirm this for yourself by adding a message box before the _FFXPath command or by using TimerInit() and TimerDiff().

Share this post


Link to post
Share on other sites
Arclite86

What you are experiencing is the initial delay where the function _FFConnect is establishing the connection to MozRepl. This should only occur once when you initiate the script.

The actual call to _FFXpath and _FFCmd runs very quickly. You can confirm this for yourself by adding a message box before the _FFXPath command or by using TimerInit() and TimerDiff().

ok, can you also explane to me how the _FFXpath and _FFCmd so i can use it on other  elements

Share this post


Link to post
Share on other sites
Arclite86

You can read the documentation for _FFXPath here. Pay particular attention to the remarks section. You will also find some examples.

could you track one more element so i am sure I understand it correctly

I need to click this button:

<a id="submit_btn" href="#x" class="btn btn_smaller 
btn_orange inline_block btn_submit_form">Login »</a>

Share this post


Link to post
Share on other sites
Arclite86

 

You can use Firebug to get the xpath. In this case, I would use:

$oButton = _FFXPath("//input[@id='submit_btn']")
_FFClick($oButton)

the code :

$oButton = _FFXPath("//input[@id='submit_btn']")
_FFClick($oButton)

does not work could you please check it agian

Share this post


Link to post
Share on other sites
Danp2

"Doesn't work" is not an adequate description. Run the script in Scite and post the complete results from the Output window.

FWIW, I'm trying to help you. However, I won't write the script for you. ;)

Share this post


Link to post
Share on other sites
Arclite86

"Doesn't work" is not an adequate description. Run the script in Scite and post the complete results from the Output window.

FWIW, I'm trying to help you. However, I won't write the script for you. ;)

ok I understand you i know you dont want to write the whole script for me, that by job, but i we can get this last fuction to work, I will know enough to learn more by my self :)

this is what is the error that I get,

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\joesoef pc\Desktop\autoit\firefox.au3" /UserParams    
+>16:07:34 Starting AutoIt3Wrapper v.2.1.4.4 SciTE v.3.3.7.0 ;  Keyboard:00020409  OS:WIN_81/  CPU:X64 OS:X64    Environment(Language:0413  Keyboard:00020409  OS:WIN_81/  CPU:X64 OS:X64)
>Running AU3Check (1.54.22.0)  from:C:\Program Files (x86)\AutoIt3
+>16:07:34 AU3Check ended.rc:0
>Running:(3.3.8.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\joesoef pc\Desktop\autoit\firefox.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
__FFStartProcess: ""C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -new-window "http://tweepi.com/auth/login"  "-repl 4242 "
_FFConnect: OS: WIN_8 WIN32_NT 9200 
_FFConnect: AutoIt: 3.3.8.1
_FFConnect: FF.au3: 0.6.0.1b-10
_FFConnect: IP: 127.0.0.1
_FFConnect: Port:   4242
_FFConnect: Delay:  2ms
_FFConnect: Socket:     712
_FFConnect: Browser:    Mozilla/5.0 (Windows NT 6.3; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
__FFSendJavaScripts: Sending functions to FireFox .......... done
_FFLoadWait: . loaded in 11ms
[object XrayWrapper [object HTMLDocument]] - {location: {...}, getElementsByName: function() {...}, getItems: function() {...}, open: function() {...}, close: function() {...}, write: function() {...}, writeln: function() {...}, ...}
__FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//form//input[@name='signin[username]']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: [object XrayWrapper [object HTMLInputElement]] - {stepUp: function() {...}, stepDown: function() {...}, checkValidity: function() {...}, setCustomValidity: function() {...}, select: function() {...}, setRangeText: function() {...}, setSelectionRange: function() {...}, ...}
__FFSend: try{FFau3.xpath.value='joesoef_9@hotmail.com'}catch(e){'_FFCmd_Err';};
__FFRecv: joesoef_9@hotmail.com
__FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//form//input[@name='signin[password]']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: [object XrayWrapper [object HTMLInputElement]] - {stepUp: function() {...}, stepDown: function() {...}, checkValidity: function() {...}, setCustomValidity: function() {...}, select: function() {...}, setRangeText: function() {...}, setSelectionRange: function() {...}, ...}
__FFSend: try{FFau3.xpath.value='dragon86'}catch(e){'_FFCmd_Err';};
__FFRecv: dragon86
__FFSend: FFau3.xpath=null;try{FFau3.xpath=FFau3.WCD.evaluate("//input[@id='submit_btn']",FFau3.WCD,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: 
__FFSend: try{FFau3.simulateEvent(FFau3.xpath,'MouseEvents','click');}catch(e){'_FFCmd_Err';};
__FFRecv: -3
_FFClick ==> No match: $sElement: FFau3.xpath
+>16:07:43 AutoIt3.exe ended.rc:0
+>16:07:43 AutoIt3Wrapper Finished..
>Exit code: 0    Time: 8.954
 

I would be very thankfull If you could help me with this last function

Edited by Arclite86

Share this post


Link to post
Share on other sites
Danp2

 

You can use Firebug to get the xpath. In this case, I would use:

$oButton = _FFXPath("//input[@id='submit_btn']")
_FFClick($oButton)

 

Looking at the HTML code, the button is actually a link, so the correct xpath would be "//a[@id='submit_btn']".

In this case, the simple answer is to use the function _FFFormSubmit() to submit the form, so the above code isn't necessary.

Share this post


Link to post
Share on other sites
Arclite86

Looking at the HTML code, the button is actually a link, so the correct xpath would be "//a[@id='submit_btn']".

In this case, the simple answer is to use the function _FFFormSubmit() to submit the form, so the above code isn't necessary.

thank you 

Share this post


Link to post
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
Sign in to follow this  

×