Dynamically Alter HTML Source
I am curious if there might be a way to dynamically alter source from a web page automatically.
For instance, I know the firebug plugin for Firefox allows the capability to modify the source and see the reaction in real-time. So, say I want to login to a particular form. Could I alter this dynamic source with a login name and password and enter the website in question via some automated script? If not, are开发者_如何学JAVA there any potential alternatives to this approach that may fair better?
Thanks.
If you want something which can automate IE browser, what I can recommend to you is: Watir and WatiN. Watir is developed in ruby while WatiN is developed in c#. They are both quite powerful, more than enough to meet your requirements.
If you have to use Python script. then I would recommend C# + WatiN + IronPython. You can write python scripts to call WatiN's dll. Please note that, IronPython is not the same as Python, it is based on microsoft's .net framework. Currently I don't know any pure python product which can do the same as WatiN and Watir.
If you want to login to a website automatically you don't need to edit the source, you need to interact with the webserver. Try curl and use it to submit login details and fetch the resulting web page.
for firefox automation, I recommend chickenfoot to you. It can meet your needs:
alter this dynamic source with a login name and password and enter the website in question via some automated script
But chechenfoot only supports up to firefox 3. If you want to support the newest version of firefox, you might have to get the source code and compile it yourself.
If you can use Javascript, try:
document.write("HTML CODE HERE");
But if you need in Python, I think you can use REPLACE in the HTML Source Code.
精彩评论