Jump to content

Firefox : activing input type="file"


Debbie
 Share

Recommended Posts

Hi

I am trying to activate a input type=file button on firefox. The web page does not belongs to me, so I can not modify it.

I use FF.au3.

I read multiple support on this point as this one :

http://www.autoitscript.com/forum/index.php?showtopic=95595&hl=firefox%20input%20type=&st=100

The HTML can be summarized as :

<body>
<form action="..." method="post" enctype="multipart/form-data">
...
    <label>Image: </label>
        <div class="margin-form">
        <input type="file" name="image" />
        </div>
...
</form>
</body>

Using the given example, I tried :

_FFXpath("//input[@type='file' and @name='image']","",9)
_FFObj("xpath.value='c:\\text.txt'")

and

_FFXpath("//input[@type='file' and @name='image']","",9)
_FFObj("xpath","value","c:\\test.txt")

No success. Did I do something wrong ?

Thanks for any help

Debbie

Link to comment
Share on other sites

Hello,

this one works with your html-code:

#include <FF.au3>

_FFConnect()

_FFXpath("//input[@type='file' and @name='image']","",9)
_FFObj("xpath.value='c:\\text.txt'")

have you any error messages in the console of your editor?

Sorry I never understood how I may get this console (I am a newbie)

I use Scite with AutoItPortable.

Nothing appears in the scite output when I open my .au3 file

with Autoit v3 script. I just installed DebugView hopping to get

them. No more information...

Regards

Debbie

Link to comment
Share on other sites

re

Thanks to another post (ConsoleWrite), here is what I got :

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3
_FFConnect: AutoIt: 3.2.10.0
_FFConnect: FF.au3: 0.5.3.8b-3
_FFConnect: IP: 127.0.0.1
_FFConnect: Port:   4242
_FFConnect: Delay:  450ms
_FFConnect: Socket:     1532
__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; fr; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 GTB5
_FFConnect: Browser:    Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 GTB5
__FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.frames["top"].document.evaluate("//input[@type='file' and @name='image']",window.content.frames["top"].document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: 
__FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.wrappedJSObject.frames["top"].document.evaluate("//input[@type='file' and @name='image']",window.content.wrappedJSObject.frames["top"].document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: [object HTMLInputElement] — {onfocus: function() {…}, onblur: function() {…}, onstartRequest: function() {…}, onstartDecode: function() {…}, onstartContainer: function() {…}, onstartFrame: function() {…}, onstopFrame: function() {…}, ...}
__FFSend: try{FFau3.xpath.value='c:\\text.txt'}catch(e){'_FFCmd_Err';};
__FFRecv: _FFCmd_Err
_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3
_FFConnect: AutoIt: 3.2.10.0
_FFConnect: FF.au3: 0.5.3.8b-3
_FFConnect: IP: 127.0.0.1
_FFConnect: Port:   4242
_FFConnect: Delay:  2ms
_FFConnect: Socket:     1504
__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; fr; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 GTB5
_FFConnect: Browser:    Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 GTB5
_FFSendJavascripts: Sending functions to FireFox ............ done
__FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.frames["top"].document.evaluate("//input[@type='file' and @name='image']",window.content.frames["top"].document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: 
__FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.wrappedJSObject.frames["top"].document.evaluate("//input[@type='file' and @name='image']",window.content.wrappedJSObject.frames["top"].document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}catch(e){'_FFXPath_Error: '+e;};
__FFRecv: [object HTMLInputElement] — {onfocus: function() {…}, onblur: function() {…}, onstartRequest: function() {…}, onstartDecode: function() {…}, onstartContainer: function() {…}, onstartFrame: function() {…}, onstopFrame: function() {…}, ...}
__FFSend: try{FFau3.xpath.value='c:\\text.txt'}catch(e){'_FFCmd_Err';};
__FFRecv: _FFCmd_Err

Does it helps ?

Regards

Debbie

Link to comment
Share on other sites

Hi

I erase line by the of my HMTL file in order to see if some of them are the issue.

And the answer is YES !

Something occurs in the header :

<head>


        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link type="text/css" rel="stylesheet" href="index.php_fichiers/datepicker.css">
        <link type="text/css" rel="stylesheet" href="index.php_fichiers/ext-all.css">
        <link type="text/css" rel="stylesheet" href="index.php_fichiers/admin.css">
        <title>PrestaShopâ„¢ - Administration panel</title>
        <script type="text/javascript">
            var search_texts = Array('product, category...', 'customer id, name, e-mail...', 'order id', 'invoice id', 'cart id');
            var helpboxes = 1;
        </script>
        <script type="text/javascript" src="index.php_fichiers/jquery-1.js"></script>
        <!-- HERE-->
        <script type="text/javascript" src="index.php_fichiers/admin.js"></script>

    </head>

Everything goes right, except if I keep:

<script type="text/javascript">
            var search_texts = Array('product, category...', 'customer id, name, e-mail...', 'order id', 'invoice id', 'cart id');
            var helpboxes = 1;
        </script>
        <!-- here -->
        <script type="text/javascript" src="index.php_fichiers/admin.js"></script>

If I remove either the part before or after the comment "here", it works.

So I tried to empty the admin.js file, just to see... and with an empty JS file, the problem remains.

Strange behavior, not ?

I can put the HTML file somewhere for testing if need.

Any idea of why such lines cause the problem ?

Thanks

Debbie

Link to comment
Share on other sites

Hi

Sorry no idea.

Put the files somewhere for testing, please.

A webpage has been posted. I sent you an private message to giv you the address.

Please, let me know if you experience the issue or if the problem only occurs on my side.

Thanks

Debbie

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...