i need something like iMacros for Python. It would be great to have something like that:
browse_to('www.google.com')
type_in_input('search', 'query')
click_button('search')
list = get_all('<p>')
Do you know something like that?
Thanks in advance, Etam.
You can write an Excel macro in python to do whatever you would previously have used VBA for. Macros work in a very similar way to worksheet functions. To register a function as a macro you use the xl_macro decorator. Macros are useful as they can be called when GUI elements (buttons, checkboxes etc.)
The idea of a macro is simply a piece of Python code that can be executed from control system interface (GUI/CLI). Therefore, anything that you don't need to be executed by the interface should NOT be a macro.
Run the Python script for Excel Note that you will have to save the Excel workbook as a '. xlsm' file to enable macro functionality. Once this is done, navigate to the 'Developer' tab and select 'Insert' and click on the button icon.
Can Python do everything VBA can? Everything you can write in VBA can be done in Python. This page contains information that will help you translate your VBA code into Python. Please note that the Excel Object Model is part of Excel and documented by Microsoft.
Almost a direct fulfillment of the wishes in the question - twill.
twill is a simple language that allows users to browse the Web from a command-line interface. With twill, you can navigate through Web sites that use forms, cookies, and most standard Web features.
twill supports automated Web testing and has a simple Python interface.
(pyparsing
, mechanize
, and BeautifulSoup
are included with twill for convenience.)
A Python API
example:
from twill.commands import go, showforms, formclear, fv, submit
go('http://issola.caltech.edu/~t/qwsgi/qwsgi-demo.cgi/')
go('./widgets')
showforms()
formclear('1')
fv("1", "name", "test")
fv("1", "password", "testpass")
fv("1", "confirm", "yes")
showforms()
submit('0')
Use mechanize. Other than executing JavaScript in a page, it's pretty good.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With