Jump to content

AutoFox Control Firefox without dependencies [Noob friendly] !


fraizor
 Share

Recommended Posts

Introducing AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !

It controls the browser using the devtools , with JS commands ...

REQUIREMENTS:

  • Firefox v120 or later

 

INSTALLATION:

  1. Copy AutoFox.au3 to "C:\Program Files (x86)\AutoIt3\Include"
  2. Use #include <AutoFox.au3> in your script

 

LIST OF FUNCTIONS:

Quote

_AFPrepare()
_AFLoad($URL)

_AFWait($Timeout = 10)

_AFLoadWait($URL, $Timeout = 10)

_AFAction($Action) ["stop", "refresh", "quit", "back", "forward", "print" ]

_AFClick($Selector)

_AFSetValue($Selector, $Value)

_AFExecute($command)

_AFScroll($x,$y)

 

Example Script:

#include <AutoFox.au3>

_AFPrepare()

_AFLoadWait("https://qavalidation.com/demo-form/",50) ;load a url with 50 seconds load timeout

_AFSetValue("#g4072-fullname","Autofox" )
_AFScroll(0,200);optional
_AFSetValue("#g4072-email","Autofox@Email.com" )
_AFSetValue("#g4072-phonenumber","0015145451514" )
_AFScroll(0,200);optional
_AFSetValue("#g4072-gender","NA" )
_AFClick("#g4072-yearsofexperience-4")
_AFClick("#g4072-skills-Automation testing")
_AFScroll(0,900);optional
_AFSetValue("#contact-form-comment-g4072-otherdetails","Will submit after 2 sec delay ...." )
_AFExecute("document.getElementById('main').style.setProperty('background-color', 'green', 'important'); "); custom JS command
Sleep(2000);optional
_AFClick(".wp-block-button__link")
_AFWait(10);wait 10 seconds for current page to finish loading
_AFAction("print");optional

 

DOWNLOAD:

Latest Version - v0.1 (15/09/2024)

AutoFox.au3

 

 

Note: This is my first UDF, i am open to all criticism 

Edited by fraizor
added comments

AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !

Link to comment
Share on other sites

Hi @fraizor 👋 ,

first of all, thanks for sharing your approach. Second of all, there is a recommended way to write UDFs (see here) - maybe you could improve your UDF to be more standardized.

In aspects of what your _AF* UDF can do and how it handles possible requirements for the browser (firefox) I have to say it's not very promising, sorry. I mean the approach use ControlSend which can not as much as it should do. Also the user have to understand javascript in depth in case of more complex tasks which he probably wants to achieve. Frameworks like Selenium, WebdriverIO or the AutoIt variant "au3WebDriver" communicate with the " JSON Wire Protocol" and use several abstractions to avoid deep intervention for the browser communication.

So please let us know which use cases you think of would be the best for your UDF.

But: Please don't be sad about this sober assessment. Every beginning is difficult and it's good that you found a way and took it 👌 .

Best regards
Sven

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

2 minutes ago, SOLVE-SMART said:

Hi @fraizor 👋 ,

first of all, thanks for sharing your approach. Second of all, there is a recommended way to write UDFs (see here) - maybe you could improve your UDF to be more standardized.

In aspects of what your _AF* UDF can do and how it handles possible requirements for the browser (firefox) I have to say it's not very promising, sorry. I mean the approach use ControlSend which can not as much as it should do. Also the user have to understand javascript in depth in case of more complex tasks which he probably wants to achieve. Frameworks like Selenium, WebdriverIO or the AutoIt variant "au3WebDriver" communicate with the " JSON Wire Protocol" and use several abstractions to avoid deep intervention for the browser communication.

So please let us know which use cases you think of would be the best for your UDF.

But: Please don't be sad about this sober assessment. Every beginning is difficult and it's good that you found a way and took it 👌 .

Best regards
Sven

Thank you for your review dear  SOLVE-SMART

1- Sure will take a look at the recommended UDF methods later , thanks 

2- Yes it is not very suitable for complex browser automation, I would say the best use case for the UDF is doing simple tasks, like filling/submitting forms and doing bulk changes for a group of pages ...

in fact i had multiple annoying tasks before that i need to do a simple checkbox click on a page then save the page (i had 100 pages) the task was stuck in the middle as it was not worth the trouble to install and learn about wedrivers and yet i cannot do them manually ... 

3- Yes i agree that ControlSend is not the most reliable function, i believe that ControlSetText  will be faster and more efficient , however i was not able to find the developer tool input box ControlID can you help me with that ? 

 

AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !

Link to comment
Share on other sites

Thanks for your use case example. I understand and would agree in case I would not know about WebDriver 😅 - but yes, fair enough.

20 minutes ago, fraizor said:

3- Yes i agree that ControlSend is not the most reliable function, i believe that ControlSetText  will be faster and more efficient , however i was not able to find the developer tool input box ControlID can you help me with that ? 

Not really, no. Sorry. Neither I would have the time nor I am interested in. Anyways best of luck @fraizor 🤝 .

Best regards
Sven

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

  • fraizor changed the title to AutoFox Control Firefox without dependencies [Noob friendly] !

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

×
×
  • Create New...